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/pxa2xx_timer.c | |
parent | 212ad111683a5b5a79a74d6141a4b75f532a4c8f (diff) |
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/pxa2xx_timer.c')
-rw-r--r-- | hw/pxa2xx_timer.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/hw/pxa2xx_timer.c b/hw/pxa2xx_timer.c index cd78d41ab4..90800751b1 100644 --- a/hw/pxa2xx_timer.c +++ b/hw/pxa2xx_timer.c @@ -486,18 +486,20 @@ static Property pxa25x_timer_dev_properties[] = { static void pxa25x_timer_dev_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = pxa2xx_timer_init; + dc->desc = "PXA25x timer"; + dc->vmsd = &vmstate_pxa2xx_timer_regs; + dc->props = pxa25x_timer_dev_properties; } -static DeviceInfo pxa25x_timer_dev_info = { - .name = "pxa25x-timer", - .desc = "PXA25x timer", - .size = sizeof(PXA2xxTimerInfo), - .vmsd = &vmstate_pxa2xx_timer_regs, - .props = pxa25x_timer_dev_properties, - .class_init = pxa25x_timer_dev_class_init, +static TypeInfo pxa25x_timer_dev_info = { + .name = "pxa25x-timer", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(PXA2xxTimerInfo), + .class_init = pxa25x_timer_dev_class_init, }; static Property pxa27x_timer_dev_properties[] = { @@ -509,23 +511,25 @@ static Property pxa27x_timer_dev_properties[] = { static void pxa27x_timer_dev_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = pxa2xx_timer_init; + dc->desc = "PXA27x timer"; + dc->vmsd = &vmstate_pxa2xx_timer_regs; + dc->props = pxa27x_timer_dev_properties; } -static DeviceInfo pxa27x_timer_dev_info = { - .name = "pxa27x-timer", - .desc = "PXA27x timer", - .size = sizeof(PXA2xxTimerInfo), - .vmsd = &vmstate_pxa2xx_timer_regs, - .props = pxa27x_timer_dev_properties, - .class_init = pxa27x_timer_dev_class_init, +static TypeInfo pxa27x_timer_dev_info = { + .name = "pxa27x-timer", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(PXA2xxTimerInfo), + .class_init = pxa27x_timer_dev_class_init, }; static void pxa2xx_timer_register(void) { - sysbus_register_withprop(&pxa25x_timer_dev_info); - sysbus_register_withprop(&pxa27x_timer_dev_info); + type_register_static(&pxa25x_timer_dev_info); + type_register_static(&pxa27x_timer_dev_info); }; device_init(pxa2xx_timer_register); |