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/spitz.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/spitz.c')
-rw-r--r-- | hw/spitz.c | 60 |
1 files changed, 34 insertions, 26 deletions
@@ -1031,17 +1031,19 @@ static Property sl_nand_properties[] = { static void sl_nand_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = sl_nand_init; + dc->vmsd = &vmstate_sl_nand_info; + dc->props = sl_nand_properties; } -static DeviceInfo sl_nand_info = { - .name = "sl-nand", - .size = sizeof(SLNANDState), - .vmsd = &vmstate_sl_nand_info, - .props = sl_nand_properties, - .class_init = sl_nand_class_init, +static TypeInfo sl_nand_info = { + .name = "sl-nand", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(SLNANDState), + .class_init = sl_nand_class_init, }; static VMStateDescription vmstate_spitz_kbd = { @@ -1064,17 +1066,19 @@ static Property spitz_keyboard_properties[] = { static void spitz_keyboard_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = spitz_keyboard_init; + dc->vmsd = &vmstate_spitz_kbd; + dc->props = spitz_keyboard_properties; } -static DeviceInfo spitz_keyboard_info = { - .name = "spitz-keyboard", - .size = sizeof(SpitzKeyboardState), - .vmsd = &vmstate_spitz_kbd, - .props = spitz_keyboard_properties, - .class_init = spitz_keyboard_class_init, +static TypeInfo spitz_keyboard_info = { + .name = "spitz-keyboard", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(SpitzKeyboardState), + .class_init = spitz_keyboard_class_init, }; static const VMStateDescription vmstate_corgi_ssp_regs = { @@ -1090,17 +1094,19 @@ static const VMStateDescription vmstate_corgi_ssp_regs = { static void corgi_ssp_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); SSISlaveClass *k = SSI_SLAVE_CLASS(klass); k->init = corgi_ssp_init; k->transfer = corgi_ssp_transfer; + dc->vmsd = &vmstate_corgi_ssp_regs; } -static DeviceInfo corgi_ssp_info = { - .name = "corgi-ssp", - .size = sizeof(CorgiSSPState), - .vmsd = &vmstate_corgi_ssp_regs, - .class_init = corgi_ssp_class_init, +static TypeInfo corgi_ssp_info = { + .name = "corgi-ssp", + .parent = TYPE_SSI_SLAVE, + .instance_size = sizeof(CorgiSSPState), + .class_init = corgi_ssp_class_init, }; static const VMStateDescription vmstate_spitz_lcdtg_regs = { @@ -1117,25 +1123,27 @@ static const VMStateDescription vmstate_spitz_lcdtg_regs = { static void spitz_lcdtg_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); SSISlaveClass *k = SSI_SLAVE_CLASS(klass); k->init = spitz_lcdtg_init; k->transfer = spitz_lcdtg_transfer; + dc->vmsd = &vmstate_spitz_lcdtg_regs; } -static DeviceInfo spitz_lcdtg_info = { - .name = "spitz-lcdtg", - .size = sizeof(SpitzLCDTG), - .vmsd = &vmstate_spitz_lcdtg_regs, - .class_init = spitz_lcdtg_class_init, +static TypeInfo spitz_lcdtg_info = { + .name = "spitz-lcdtg", + .parent = TYPE_SSI_SLAVE, + .instance_size = sizeof(SpitzLCDTG), + .class_init = spitz_lcdtg_class_init, }; static void spitz_register_devices(void) { - ssi_register_slave(&corgi_ssp_info); - ssi_register_slave(&spitz_lcdtg_info); - sysbus_register_withprop(&spitz_keyboard_info); - sysbus_register_withprop(&sl_nand_info); + type_register_static(&corgi_ssp_info); + type_register_static(&spitz_lcdtg_info); + type_register_static(&spitz_keyboard_info); + type_register_static(&sl_nand_info); } device_init(spitz_register_devices) |