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/arm_timer.c | |
parent | 212ad111683a5b5a79a74d6141a4b75f532a4c8f (diff) | |
download | qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.tar.gz |
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/arm_timer.c')
-rw-r--r-- | hw/arm_timer.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/hw/arm_timer.c b/hw/arm_timer.c index 15eb37c25d..1019d41b3e 100644 --- a/hw/arm_timer.c +++ b/hw/arm_timer.c @@ -354,34 +354,39 @@ static void icp_pit_class_init(ObjectClass *klass, void *data) sdc->init = icp_pit_init; } -static DeviceInfo icp_pit_info = { - .name = "integrator_pit", - .size = sizeof(icp_pit_state), - .class_init = icp_pit_class_init, +static TypeInfo icp_pit_info = { + .name = "integrator_pit", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(icp_pit_state), + .class_init = icp_pit_class_init, +}; + +static Property sp804_properties[] = { + DEFINE_PROP_UINT32("freq0", sp804_state, freq0, 1000000), + DEFINE_PROP_UINT32("freq1", sp804_state, freq1, 1000000), + DEFINE_PROP_END_OF_LIST(), }; static void sp804_class_init(ObjectClass *klass, void *data) { SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); + DeviceClass *k = DEVICE_CLASS(klass); sdc->init = sp804_init; + k->props = sp804_properties; } -static DeviceInfo sp804_info = { - .name = "sp804", - .size = sizeof(sp804_state), - .class_init = sp804_class_init, - .props = (Property[]) { - DEFINE_PROP_UINT32("freq0", sp804_state, freq0, 1000000), - DEFINE_PROP_UINT32("freq1", sp804_state, freq1, 1000000), - DEFINE_PROP_END_OF_LIST(), - } +static TypeInfo sp804_info = { + .name = "sp804", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(sp804_state), + .class_init = sp804_class_init, }; static void arm_timer_register_devices(void) { - sysbus_qdev_register(&icp_pit_info); - sysbus_qdev_register(&sp804_info); + type_register_static(&icp_pit_info); + type_register_static(&sp804_info); } device_init(arm_timer_register_devices) |