qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 6/7] [RFC] Use DEFINE_MACHINE to register all


From: Michael Walle
Subject: Re: [Qemu-devel] [PATCH v2 6/7] [RFC] Use DEFINE_MACHINE to register all machines
Date: Wed, 19 Aug 2015 10:25:34 +0200
User-agent: Roundcube Webmail/0.9.5

Am 2015-08-18 23:43, schrieb Eduardo Habkost:
I am sending a single patch for all machines to get some feedback, but
in the final patch series I will separate them by architecture.

Signed-off-by: Eduardo Habkost <address@hidden>
---
(Sending v2 of just patch 6/7 to avoid resending the whole series)

Changes v1 -> v2:
* Fix trailing spaces and newlines
* Don't touch "//" comments on lines that we are not changing
* Break long lines manually
---

diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
index 70f48d3..385c25d 100644
--- a/hw/lm32/lm32_boards.c
+++ b/hw/lm32/lm32_boards.c
@@ -292,24 +292,21 @@ static void lm32_uclinux_init(MachineState *machine)
     qemu_register_reset(main_cpu_reset, reset_info);
 }

-static QEMUMachine lm32_evr_machine = {
-    .name = "lm32-evr",
-    .desc = "LatticeMico32 EVR32 eval system",
-    .init = lm32_evr_init,
-    .is_default = 1,
-};
-
-static QEMUMachine lm32_uclinux_machine = {
-    .name = "lm32-uclinux",
- .desc = "lm32 platform for uClinux and u-boot by Theobroma Systems",
-    .init = lm32_uclinux_init,
-    .is_default = 0,
-};
-
-static void lm32_machine_init(void)
+static void lm32_evr_machine_machine_init(MachineClass *mc)
 {
-    qemu_register_machine(&lm32_uclinux_machine);
-    qemu_register_machine(&lm32_evr_machine);
+    mc->desc = "LatticeMico32 EVR32 eval system";
+    mc->init = lm32_evr_init;
+    mc->is_default = 1;
 }

-machine_init(lm32_machine_init);
+DEFINE_MACHINE("lm32-evr", lm32_evr_machine_machine_init);

lm32_evr_machine_machine_init, should be lm32_evr_machine_init. Maybe you can enable your script to detect "machine_machine" and just use one "machine" then. Same below.


+
+static void lm32_uclinux_machine_machine_init(MachineClass *mc)
+{
+ mc->desc = "lm32 platform for uClinux and u-boot by Theobroma Systems";
+    mc->init = lm32_uclinux_init;
+    mc->is_default = 0;
+}
+
+DEFINE_MACHINE("lm32-uclinux", lm32_uclinux_machine_machine_init);
+
diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c
index e755f5b..a891fb5 100644
--- a/hw/lm32/milkymist.c
+++ b/hw/lm32/milkymist.c
@@ -209,16 +209,12 @@ milkymist_init(MachineState *machine)
     qemu_register_reset(main_cpu_reset, reset_info);
 }

-static QEMUMachine milkymist_machine = {
-    .name = "milkymist",
-    .desc = "Milkymist One",
-    .init = milkymist_init,
-    .is_default = 0,
-};
-
-static void milkymist_machine_init(void)
+static void milkymist_machine_machine_init(MachineClass *mc)
 {
-    qemu_register_machine(&milkymist_machine);
+    mc->desc = "Milkymist One";
+    mc->init = milkymist_init;
+    mc->is_default = 0;
 }

-machine_init(milkymist_machine_init);
+DEFINE_MACHINE("milkymist", milkymist_machine_machine_init);
+





reply via email to

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