diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-12-07 21:34:16 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-02-03 10:41:06 -0600 |
commit | 39bffca2030950ef6efe57c2fac8327a45ae1015 (patch) | |
tree | 325262f44978e6116c9e43f688c900e08ee83738 /hw/isa-bus.c | |
parent | 212ad111683a5b5a79a74d6141a4b75f532a4c8f (diff) | |
download | qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.zip qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.tar.gz qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.tar.bz2 |
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and then
rebased it into a single step which avoids repeatedly touching every file in
the tree.
The first step was a sed-based addition of the parent type to the subclass
registration functions.
The second step was another sed-based removal of subclass registration functions
while also adding virtual functions from the base class into a class_init
function as appropriate.
Finally, a python script was used to convert the DeviceInfo structures and
qdev_register_subclass functions to TypeInfo structures, class_init functions,
and type_register_static calls.
We are almost fully converted to QOM after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/isa-bus.c')
-rw-r--r-- | hw/isa-bus.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 92d8882..a22c5c6 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -125,18 +125,6 @@ static int isa_qdev_init(DeviceState *qdev, DeviceInfo *base) return 0; } -void isa_qdev_register_subclass(DeviceInfo *info, const char *parent) -{ - info->init = isa_qdev_init; - info->bus_info = &isa_bus_info; - qdev_register_subclass(info, parent); -} - -void isa_qdev_register(DeviceInfo *info) -{ - isa_qdev_register_subclass(info, TYPE_ISA_DEVICE); -} - ISADevice *isa_create(ISABus *bus, const char *name) { DeviceState *dev; @@ -191,30 +179,40 @@ static int isabus_bridge_init(SysBusDevice *dev) static void isabus_bridge_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = isabus_bridge_init; + dc->fw_name = "isa"; + dc->no_user = 1; } -static DeviceInfo isabus_bridge_info = { - .name = "isabus-bridge", - .fw_name = "isa", - .size = sizeof(SysBusDevice), - .no_user = 1, - .class_init = isabus_bridge_class_init, +static TypeInfo isabus_bridge_info = { + .name = "isabus-bridge", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(SysBusDevice), + .class_init = isabus_bridge_class_init, }; +static void isa_device_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *k = DEVICE_CLASS(klass); + k->init = isa_qdev_init; + k->bus_info = &isa_bus_info; +} + static TypeInfo isa_device_type_info = { .name = TYPE_ISA_DEVICE, .parent = TYPE_DEVICE, .instance_size = sizeof(ISADevice), .abstract = true, .class_size = sizeof(ISADeviceClass), + .class_init = isa_device_class_init, }; static void isabus_register_devices(void) { - sysbus_register_withprop(&isabus_bridge_info); + type_register_static(&isabus_bridge_info); type_register_static(&isa_device_type_info); } |