mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-01 06:21:52 -06:00
hw/sysbus: Declare QOM types using DEFINE_TYPES() macro
When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alexander Graf <graf@amazon.com> Reviewed-by: Clément Mathieu--Drif <clement.mathieu--drif@eviden.com> Reviewed-by: Bernhard Beschow <shentey@gmail.com> Message-Id: <20250125181343.59151-3-philmd@linaro.org>
This commit is contained in:
parent
d4194e19cc
commit
45683d1e7c
1 changed files with 17 additions and 23 deletions
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu/module.h"
|
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
#include "exec/address-spaces.h"
|
#include "exec/address-spaces.h"
|
||||||
|
@ -80,13 +79,6 @@ static void system_bus_class_init(ObjectClass *klass, void *data)
|
||||||
k->get_fw_dev_path = sysbus_get_fw_dev_path;
|
k->get_fw_dev_path = sysbus_get_fw_dev_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo system_bus_info = {
|
|
||||||
.name = TYPE_SYSTEM_BUS,
|
|
||||||
.parent = TYPE_BUS,
|
|
||||||
.instance_size = sizeof(BusState),
|
|
||||||
.class_init = system_bus_class_init,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Check whether an IRQ source exists */
|
/* Check whether an IRQ source exists */
|
||||||
bool sysbus_has_irq(SysBusDevice *dev, int n)
|
bool sysbus_has_irq(SysBusDevice *dev, int n)
|
||||||
{
|
{
|
||||||
|
@ -306,15 +298,6 @@ static void sysbus_device_class_init(ObjectClass *klass, void *data)
|
||||||
k->user_creatable = false;
|
k->user_creatable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo sysbus_device_type_info = {
|
|
||||||
.name = TYPE_SYS_BUS_DEVICE,
|
|
||||||
.parent = TYPE_DEVICE,
|
|
||||||
.instance_size = sizeof(SysBusDevice),
|
|
||||||
.abstract = true,
|
|
||||||
.class_size = sizeof(SysBusDeviceClass),
|
|
||||||
.class_init = sysbus_device_class_init,
|
|
||||||
};
|
|
||||||
|
|
||||||
static BusState *main_system_bus;
|
static BusState *main_system_bus;
|
||||||
|
|
||||||
static void main_system_bus_create(void)
|
static void main_system_bus_create(void)
|
||||||
|
@ -337,10 +320,21 @@ BusState *sysbus_get_default(void)
|
||||||
return main_system_bus;
|
return main_system_bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sysbus_register_types(void)
|
static const TypeInfo sysbus_types[] = {
|
||||||
{
|
{
|
||||||
type_register_static(&system_bus_info);
|
.name = TYPE_SYSTEM_BUS,
|
||||||
type_register_static(&sysbus_device_type_info);
|
.parent = TYPE_BUS,
|
||||||
}
|
.instance_size = sizeof(BusState),
|
||||||
|
.class_init = system_bus_class_init,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = TYPE_SYS_BUS_DEVICE,
|
||||||
|
.parent = TYPE_DEVICE,
|
||||||
|
.instance_size = sizeof(SysBusDevice),
|
||||||
|
.abstract = true,
|
||||||
|
.class_size = sizeof(SysBusDeviceClass),
|
||||||
|
.class_init = sysbus_device_class_init,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
type_init(sysbus_register_types)
|
DEFINE_TYPES(sysbus_types)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue