summaryrefslogtreecommitdiffstats
path: root/hw/usb-ohci.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-ohci.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-ohci.c')
-rw-r--r--hw/usb-ohci.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 3437da1..425030f 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1845,44 +1845,50 @@ static Property ohci_pci_properties[] = {
static void ohci_pci_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_ohci_initfn_pci;
k->vendor_id = PCI_VENDOR_ID_APPLE;
k->device_id = PCI_DEVICE_ID_APPLE_IPID_USB;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->desc = "Apple USB Controller";
+ dc->props = ohci_pci_properties;
}
-static DeviceInfo ohci_pci_info = {
- .name = "pci-ohci",
- .desc = "Apple USB Controller",
- .size = sizeof(OHCIPCIState),
- .props = ohci_pci_properties,
- .class_init = ohci_pci_class_init,
+static TypeInfo ohci_pci_info = {
+ .name = "pci-ohci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(OHCIPCIState),
+ .class_init = ohci_pci_class_init,
+};
+
+static Property ohci_sysbus_properties[] = {
+ DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3),
+ DEFINE_PROP_TADDR("dma-offset", OHCISysBusState, dma_offset, 3),
+ DEFINE_PROP_END_OF_LIST(),
};
static void ohci_sysbus_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
sbc->init = ohci_init_pxa;
+ dc->desc = "OHCI USB Controller";
+ dc->props = ohci_sysbus_properties;
}
-static DeviceInfo ohci_sysbus_info = {
- .name = "sysbus-ohci",
- .desc = "OHCI USB Controller",
- .size = sizeof(OHCISysBusState),
- .class_init = ohci_sysbus_class_init,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3),
- DEFINE_PROP_TADDR("dma-offset", OHCISysBusState, dma_offset, 3),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo ohci_sysbus_info = {
+ .name = "sysbus-ohci",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(OHCISysBusState),
+ .class_init = ohci_sysbus_class_init,
};
static void ohci_register(void)
{
- pci_qdev_register(&ohci_pci_info);
- sysbus_register_withprop(&ohci_sysbus_info);
+ type_register_static(&ohci_pci_info);
+ type_register_static(&ohci_sysbus_info);
}
device_init(ohci_register);
OpenPOWER on IntegriCloud