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/xtensa/xtfpga.c | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 8 deletions(-) (limited to 'hw/xtensa') diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index d6ddfa1..7aca1cf 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -428,38 +428,72 @@ static void xtensa_kc705_init(MachineState *machine) lx_init(&kc705_board, machine); } -static void xtensa_lx60_machine_init(MachineClass *mc) +static void xtensa_lx60_class_init(ObjectClass *oc, void *data) { + MachineClass *mc = MACHINE_CLASS(oc); + mc->desc = "lx60 EVB (" XTENSA_DEFAULT_CPU_MODEL ")"; mc->init = xtensa_lx60_init; mc->max_cpus = 4; } -DEFINE_MACHINE("lx60", xtensa_lx60_machine_init) +static const TypeInfo xtensa_lx60_type = { + .name = MACHINE_TYPE_NAME("lx60"), + .parent = TYPE_MACHINE, + .class_init = xtensa_lx60_class_init, +}; -static void xtensa_lx200_machine_init(MachineClass *mc) +static void xtensa_lx200_class_init(ObjectClass *oc, void *data) { + MachineClass *mc = MACHINE_CLASS(oc); + mc->desc = "lx200 EVB (" XTENSA_DEFAULT_CPU_MODEL ")"; mc->init = xtensa_lx200_init; mc->max_cpus = 4; } -DEFINE_MACHINE("lx200", xtensa_lx200_machine_init) +static const TypeInfo xtensa_lx200_type = { + .name = MACHINE_TYPE_NAME("lx200"), + .parent = TYPE_MACHINE, + .class_init = xtensa_lx200_class_init, +}; -static void xtensa_ml605_machine_init(MachineClass *mc) +static void xtensa_ml605_class_init(ObjectClass *oc, void *data) { + MachineClass *mc = MACHINE_CLASS(oc); + mc->desc = "ml605 EVB (" XTENSA_DEFAULT_CPU_MODEL ")"; mc->init = xtensa_ml605_init; mc->max_cpus = 4; } -DEFINE_MACHINE("ml605", xtensa_ml605_machine_init) +static const TypeInfo xtensa_ml605_type = { + .name = MACHINE_TYPE_NAME("ml605"), + .parent = TYPE_MACHINE, + .class_init = xtensa_ml605_class_init, +}; -static void xtensa_kc705_machine_init(MachineClass *mc) +static void xtensa_kc705_class_init(ObjectClass *oc, void *data) { + MachineClass *mc = MACHINE_CLASS(oc); + mc->desc = "kc705 EVB (" XTENSA_DEFAULT_CPU_MODEL ")"; mc->init = xtensa_kc705_init; mc->max_cpus = 4; } -DEFINE_MACHINE("kc705", xtensa_kc705_machine_init) +static const TypeInfo xtensa_kc705_type = { + .name = MACHINE_TYPE_NAME("kc705"), + .parent = TYPE_MACHINE, + .class_init = xtensa_kc705_class_init, +}; + +static void xtensa_lx_machines_init(void) +{ + type_register_static(&xtensa_lx60_type); + type_register_static(&xtensa_lx200_type); + type_register_static(&xtensa_ml605_type); + type_register_static(&xtensa_kc705_type); +} + +machine_init(xtensa_lx_machines_init) -- cgit v1.1