aboutsummaryrefslogtreecommitdiff
path: root/hw/lm32/lm32_boards.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2015-09-19 10:49:44 +0200
committerAndreas Färber <afaerber@suse.de>2015-09-19 16:40:27 +0200
commit8a661aea0e7f6e776c6ebc9abe339a85b34fea1d (patch)
treebdb4040a63f38d86d8c84157b60d71a84927ebb7 /hw/lm32/lm32_boards.c
parente264d29de28c5b0be3d063307ce9fb613b427cc3 (diff)
Revert use of DEFINE_MACHINE() for registrations of multiple machines
The script used for converting from QEMUMachine had used one DEFINE_MACHINE() per machine registered. In cases where multiple machines are registered from one source file, avoid the excessive generation of module init functions by reverting this unrolling. Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/lm32/lm32_boards.c')
-rw-r--r--hw/lm32/lm32_boards.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
index 04d2066299..8e17a82a40 100644
--- a/hw/lm32/lm32_boards.c
+++ b/hw/lm32/lm32_boards.c
@@ -292,20 +292,40 @@ static void lm32_uclinux_init(MachineState *machine)
qemu_register_reset(main_cpu_reset, reset_info);
}
-static void lm32_evr_machine_init(MachineClass *mc)
+static void lm32_evr_class_init(ObjectClass *oc, void *data)
{
+ MachineClass *mc = MACHINE_CLASS(oc);
+
mc->desc = "LatticeMico32 EVR32 eval system";
mc->init = lm32_evr_init;
mc->is_default = 1;
}
-DEFINE_MACHINE("lm32-evr", lm32_evr_machine_init)
+static const TypeInfo lm32_evr_type = {
+ .name = MACHINE_TYPE_NAME("lm32-evr"),
+ .parent = TYPE_MACHINE,
+ .class_init = lm32_evr_class_init,
+};
-static void lm32_uclinux_machine_init(MachineClass *mc)
+static void lm32_uclinux_class_init(ObjectClass *oc, void *data)
{
+ MachineClass *mc = MACHINE_CLASS(oc);
+
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_init)
+static const TypeInfo lm32_uclinux_type = {
+ .name = MACHINE_TYPE_NAME("lm32-uclinux"),
+ .parent = TYPE_MACHINE,
+ .class_init = lm32_uclinux_class_init,
+};
+
+static void lm32_machine_init(void)
+{
+ type_register_static(&lm32_evr_type);
+ type_register_static(&lm32_uclinux_type);
+}
+
+machine_init(lm32_machine_init)