qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC v2 12/39] q35: Eliminate pc_q35_machine_options()


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC v2 12/39] q35: Eliminate pc_q35_machine_options()
Date: Fri, 13 Jun 2014 16:43:51 -0300

Instead of calling it on every q35 class_init function, just register a
common parent class for all q35 machine-types.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 hw/i386/pc_q35.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 521bff7..5750239 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -319,15 +319,24 @@ static void pc_q35_init_1_4(MachineState *machine)
     pc_q35_init(machine);
 }
 
-static void pc_q35_machine_options(MachineClass *mc)
+static void pc_q35_machine_class_init(ObjectClass *oc, void *data)
 {
+    MachineClass *mc = MACHINE_CLASS(oc);
     mc->desc = "Standard PC (Q35 + ICH9, 2009)";
     mc->hot_add_cpu = pc_hot_add_cpu;
 }
 
+#define TYPE_PC_Q35_MACHINE "pc-q35" TYPE_MACHINE_SUFFIX
+
+static TypeInfo pc_q35_machine_type_info = {
+    .name = TYPE_PC_Q35_MACHINE,
+    .parent = TYPE_PC_MACHINE,
+    .class_init = pc_q35_machine_class_init,
+    .abstract = true,
+};
+
 static void pc_q35_2_1_machine_options(MachineClass *mc)
 {
-    pc_q35_machine_options(mc);
     mc->default_machine_opts = "firmware=bios-256k.bin";
 }
 
@@ -342,7 +351,7 @@ static void pc_q35_machine_v2_1_class_init(ObjectClass *oc, 
void *data)
 
 static TypeInfo pc_q35_machine_v2_1_type_info = {
     .name = "pc-q35-2.1" TYPE_MACHINE_SUFFIX,
-    .parent = TYPE_PC_MACHINE,
+    .parent = TYPE_PC_Q35_MACHINE,
     .class_init = pc_q35_machine_v2_1_class_init,
 };
 
@@ -363,12 +372,10 @@ static void pc_q35_machine_v2_0_class_init(ObjectClass 
*oc, void *data)
 
 static TypeInfo pc_q35_machine_v2_0_type_info = {
     .name = "pc-q35-2.0" TYPE_MACHINE_SUFFIX,
-    .parent = TYPE_PC_MACHINE,
+    .parent = TYPE_PC_Q35_MACHINE,
     .class_init = pc_q35_machine_v2_0_class_init,
 };
 
-#define pc_q35_1_7_machine_options pc_q35_machine_options
-
 static void pc_q35_machine_v1_7_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -376,7 +383,6 @@ static void pc_q35_machine_v1_7_class_init(ObjectClass *oc, 
void *data)
         PC_Q35_COMPAT_1_7,
         { /* end of list */ }
     };
-    pc_q35_1_7_machine_options(mc);
     mc->init = pc_q35_init_1_7;
     machine_class_add_compat_props(mc, compat_props);
     mc->name = "pc-q35-1.7";
@@ -384,12 +390,10 @@ static void pc_q35_machine_v1_7_class_init(ObjectClass 
*oc, void *data)
 
 static TypeInfo pc_q35_machine_v1_7_type_info = {
     .name = "pc-q35-1.7" TYPE_MACHINE_SUFFIX,
-    .parent = TYPE_PC_MACHINE,
+    .parent = TYPE_PC_Q35_MACHINE,
     .class_init = pc_q35_machine_v1_7_class_init,
 };
 
-#define pc_q35_1_6_machine_options pc_q35_machine_options
-
 static void pc_q35_machine_v1_6_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -397,7 +401,6 @@ static void pc_q35_machine_v1_6_class_init(ObjectClass *oc, 
void *data)
         PC_Q35_COMPAT_1_6,
         { /* end of list */ }
     };
-    pc_q35_1_6_machine_options(mc);
     mc->init = pc_q35_init_1_6;
     machine_class_add_compat_props(mc, compat_props);
     mc->name = "pc-q35-1.6";
@@ -405,7 +408,7 @@ static void pc_q35_machine_v1_6_class_init(ObjectClass *oc, 
void *data)
 
 static TypeInfo pc_q35_machine_v1_6_type_info = {
     .name = "pc-q35-1.6" TYPE_MACHINE_SUFFIX,
-    .parent = TYPE_PC_MACHINE,
+    .parent = TYPE_PC_Q35_MACHINE,
     .class_init = pc_q35_machine_v1_6_class_init,
 };
 
@@ -416,7 +419,6 @@ static void pc_q35_machine_v1_5_class_init(ObjectClass *oc, 
void *data)
         PC_Q35_COMPAT_1_5,
         { /* end of list */ }
     };
-    pc_q35_1_6_machine_options(mc);
     mc->init = pc_q35_init_1_5;
     machine_class_add_compat_props(mc, compat_props);
     mc->name = "pc-q35-1.5";
@@ -424,13 +426,12 @@ static void pc_q35_machine_v1_5_class_init(ObjectClass 
*oc, void *data)
 
 static TypeInfo pc_q35_machine_v1_5_type_info = {
     .name = "pc-q35-1.5" TYPE_MACHINE_SUFFIX,
-    .parent = TYPE_PC_MACHINE,
+    .parent = TYPE_PC_Q35_MACHINE,
     .class_init = pc_q35_machine_v1_5_class_init,
 };
 
 static void pc_q35_1_4_machine_options(MachineClass *mc)
 {
-    pc_q35_1_6_machine_options(mc);
     mc->hot_add_cpu = NULL;
 }
 
@@ -449,12 +450,13 @@ static void pc_q35_machine_v1_4_class_init(ObjectClass 
*oc, void *data)
 
 static TypeInfo pc_q35_machine_v1_4_type_info = {
     .name = "pc-q35-1.4" TYPE_MACHINE_SUFFIX,
-    .parent = TYPE_PC_MACHINE,
+    .parent = TYPE_PC_Q35_MACHINE,
     .class_init = pc_q35_machine_v1_4_class_init,
 };
 
 static void pc_q35_machine_init(void)
 {
+    type_register_static(&pc_q35_machine_type_info);
     type_register_static(&pc_q35_machine_v2_1_type_info);
     type_register_static(&pc_q35_machine_v2_0_type_info);
     type_register_static(&pc_q35_machine_v1_7_type_info);
-- 
1.9.0




reply via email to

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