summaryrefslogtreecommitdiffstats
path: root/hw/usb-ehci.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-07 21:34:16 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-02-03 10:41:06 -0600
commit39bffca2030950ef6efe57c2fac8327a45ae1015 (patch)
tree325262f44978e6116c9e43f688c900e08ee83738 /hw/usb-ehci.c
parent212ad111683a5b5a79a74d6141a4b75f532a4c8f (diff)
downloadhqemu-39bffca2030950ef6efe57c2fac8327a45ae1015.zip
hqemu-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/usb-ehci.c')
-rw-r--r--hw/usb-ehci.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 8baff1d..75ef71e 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -2265,6 +2265,7 @@ static Property ehci_properties[] = {
static void ehci_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_ehci_initfn;
@@ -2272,18 +2273,20 @@ static void ehci_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82801D; /* ich4 */
k->revision = 0x10;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->vmsd = &vmstate_ehci;
+ dc->props = ehci_properties;
}
-static DeviceInfo ehci_info = {
- .name = "usb-ehci",
- .size = sizeof(EHCIState),
- .vmsd = &vmstate_ehci,
- .props = ehci_properties,
- .class_init = ehci_class_init,
+static TypeInfo ehci_info = {
+ .name = "usb-ehci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(EHCIState),
+ .class_init = ehci_class_init,
};
static void ich9_ehci_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_ehci_initfn;
@@ -2291,14 +2294,15 @@ static void ich9_ehci_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82801I_EHCI1;
k->revision = 0x03;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->vmsd = &vmstate_ehci;
+ dc->props = ehci_properties;
}
-static DeviceInfo ich9_ehci_info = {
- .name = "ich9-usb-ehci1",
- .size = sizeof(EHCIState),
- .vmsd = &vmstate_ehci,
- .props = ehci_properties,
- .class_init = ich9_ehci_class_init,
+static TypeInfo ich9_ehci_info = {
+ .name = "ich9-usb-ehci1",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(EHCIState),
+ .class_init = ich9_ehci_class_init,
};
static int usb_ehci_initfn(PCIDevice *dev)
@@ -2374,8 +2378,8 @@ static int usb_ehci_initfn(PCIDevice *dev)
static void ehci_register(void)
{
- pci_qdev_register(&ehci_info);
- pci_qdev_register(&ich9_ehci_info);
+ type_register_static(&ehci_info);
+ type_register_static(&ich9_ehci_info);
}
device_init(ehci_register);
OpenPOWER on IntegriCloud