diff options
author | Anthony Liguori | 2011-12-08 04:34:16 +0100 |
---|---|---|
committer | Anthony Liguori | 2012-02-03 17:41:06 +0100 |
commit | 39bffca2030950ef6efe57c2fac8327a45ae1015 (patch) | |
tree | 325262f44978e6116c9e43f688c900e08ee83738 /hw/rtl8139.c | |
parent | qdev: kill off DeviceInfo list (diff) | |
download | qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.tar.gz qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.tar.xz qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.zip |
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/rtl8139.c')
-rw-r--r-- | hw/rtl8139.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 15dec9bfec..1668390e1f 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -3501,6 +3501,7 @@ static Property rtl8139_properties[] = { static void rtl8139_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->init = pci_rtl8139_init; @@ -3510,20 +3511,21 @@ static void rtl8139_class_init(ObjectClass *klass, void *data) k->device_id = PCI_DEVICE_ID_REALTEK_8139; k->revision = RTL8139_PCI_REVID; /* >=0x20 is for 8139C+ */ k->class_id = PCI_CLASS_NETWORK_ETHERNET; + dc->reset = rtl8139_reset; + dc->vmsd = &vmstate_rtl8139; + dc->props = rtl8139_properties; } -static DeviceInfo rtl8139_info = { - .name = "rtl8139", - .size = sizeof(RTL8139State), - .reset = rtl8139_reset, - .vmsd = &vmstate_rtl8139, - .props = rtl8139_properties, - .class_init = rtl8139_class_init, +static TypeInfo rtl8139_info = { + .name = "rtl8139", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(RTL8139State), + .class_init = rtl8139_class_init, }; static void rtl8139_register_devices(void) { - pci_qdev_register(&rtl8139_info); + type_register_static(&rtl8139_info); } device_init(rtl8139_register_devices) |