From 8a661aea0e7f6e776c6ebc9abe339a85b34fea1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sat, 19 Sep 2015 10:49:44 +0200 Subject: Revert use of DEFINE_MACHINE() for registrations of multiple machines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- hw/lm32/lm32_boards.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'hw/lm32/lm32_boards.c') diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c index 04d2066..8e17a82 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) -- cgit v1.1