qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC v2 30/39] pc: Eliminate empty or trivial compat functi


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC v2 30/39] pc: Eliminate empty or trivial compat functions
Date: Fri, 13 Jun 2014 16:44:09 -0300

When all a compat function does is to call the previous compat function,
we don't need to set compat_func, as the previous class_init function
already set it.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 hw/i386/pc_piix.c | 21 +--------------------
 hw/i386/pc_q35.c  | 21 +--------------------
 2 files changed, 2 insertions(+), 40 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index aef23b1..3549edb 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -261,29 +261,14 @@ static void pc_init1(MachineState *machine)
     }
 }
 
-static void pc_compat_2_0(MachineState *machine)
-{
-}
-
 static void pc_compat_1_7(MachineState *machine)
 {
-    pc_compat_2_0(machine);
     x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
 }
 
-static void pc_compat_1_6(MachineState *machine)
-{
-    pc_compat_1_7(machine);
-}
-
-static void pc_compat_1_5(MachineState *machine)
-{
-    pc_compat_1_6(machine);
-}
-
 static void pc_compat_1_4(MachineState *machine)
 {
-    pc_compat_1_5(machine);
+    pc_compat_1_7(machine);
     x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
     x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, 
CPUID_EXT_PCLMULQDQ);
 }
@@ -393,7 +378,6 @@ static void pc_i440fx_machine_v2_0_class_init(ObjectClass 
*oc, void *data)
     machine_class_add_compat_props(mc, compat_props);
     pcmc->smbios_legacy_mode = true;
     pcmc->has_reserved_memory = false;
-    pcmc->compat_func = pc_compat_2_0;
 }
 
 static TypeInfo pc_i440fx_machine_v2_0_type_info = {
@@ -439,7 +423,6 @@ static void pc_i440fx_machine_v1_6_class_init(ObjectClass 
*oc, void *data)
     mc->rom_file_has_mr = false;
     machine_class_add_compat_props(mc, compat_props);
     pcmc->has_acpi_build = false;
-    pcmc->compat_func = pc_compat_1_6;
 }
 
 static TypeInfo pc_i440fx_machine_v1_6_type_info = {
@@ -451,7 +434,6 @@ static TypeInfo pc_i440fx_machine_v1_6_type_info = {
 static void pc_i440fx_machine_v1_5_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
-    PCMachineClass *pcmc = PC_MACHINE_CLASS(oc);
     static GlobalProperty compat_props[] = {
         PC_COMPAT_1_5,
         { /* end of list */ }
@@ -459,7 +441,6 @@ static void pc_i440fx_machine_v1_5_class_init(ObjectClass 
*oc, void *data)
     pc_i440fx_machine_v1_6_class_init(oc, data);
     mc->name = "pc-i440fx-1.5";
     machine_class_add_compat_props(mc, compat_props);
-    pcmc->compat_func = pc_compat_1_5;
 }
 
 static TypeInfo pc_i440fx_machine_v1_5_type_info = {
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index aa27314..9e30130 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -244,29 +244,14 @@ static void pc_q35_init(MachineState *machine)
     }
 }
 
-static void pc_compat_2_0(MachineState *machine)
-{
-}
-
 static void pc_compat_1_7(MachineState *machine)
 {
-    pc_compat_2_0(machine);
     x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
 }
 
-static void pc_compat_1_6(MachineState *machine)
-{
-    pc_compat_1_7(machine);
-}
-
-static void pc_compat_1_5(MachineState *machine)
-{
-    pc_compat_1_6(machine);
-}
-
 static void pc_compat_1_4(MachineState *machine)
 {
-    pc_compat_1_5(machine);
+    pc_compat_1_7(machine);
     x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
     x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, 
CPUID_EXT_PCLMULQDQ);
 }
@@ -319,7 +304,6 @@ static void pc_q35_machine_v2_0_class_init(ObjectClass *oc, 
void *data)
     mc->name = "pc-q35-2.0";
     pcmc->smbios_legacy_mode = true;
     pcmc->has_reserved_memory = false;
-    pcmc->compat_func = pc_compat_2_0;
 }
 
 static TypeInfo pc_q35_machine_v2_0_type_info = {
@@ -364,7 +348,6 @@ static void pc_q35_machine_v1_6_class_init(ObjectClass *oc, 
void *data)
     mc->rom_file_has_mr = false;
     machine_class_add_compat_props(mc, compat_props);
     mc->name = "pc-q35-1.6";
-    pcmc->compat_func = pc_compat_1_6;
     pcmc->has_acpi_build = false;
 }
 
@@ -377,7 +360,6 @@ static TypeInfo pc_q35_machine_v1_6_type_info = {
 static void pc_q35_machine_v1_5_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
-    PCMachineClass *pcmc = PC_MACHINE_CLASS(oc);
     static GlobalProperty compat_props[] = {
         PC_Q35_COMPAT_1_5,
         { /* end of list */ }
@@ -385,7 +367,6 @@ static void pc_q35_machine_v1_5_class_init(ObjectClass *oc, 
void *data)
     pc_q35_machine_v1_6_class_init(oc, data);
     machine_class_add_compat_props(mc, compat_props);
     mc->name = "pc-q35-1.5";
-    pcmc->compat_func = pc_compat_1_5;
 }
 
 static TypeInfo pc_q35_machine_v1_5_type_info = {
-- 
1.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]