summaryrefslogtreecommitdiff
path: root/usb-linux.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 /usb-linux.c
parent212ad111683a5b5a79a74d6141a4b75f532a4c8f (diff)
downloadqemu-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 'usb-linux.c')
-rw-r--r--usb-linux.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/usb-linux.c b/usb-linux.c
index a337db5296..e7fc9ecd5c 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1402,8 +1402,19 @@ static const VMStateDescription vmstate_usb_host = {
.unmigratable = 1,
};
+static Property usb_host_dev_properties[] = {
+ DEFINE_PROP_UINT32("hostbus", USBHostDevice, match.bus_num, 0),
+ DEFINE_PROP_UINT32("hostaddr", USBHostDevice, match.addr, 0),
+ DEFINE_PROP_STRING("hostport", USBHostDevice, match.port),
+ DEFINE_PROP_HEX32("vendorid", USBHostDevice, match.vendor_id, 0),
+ DEFINE_PROP_HEX32("productid", USBHostDevice, match.product_id, 0),
+ DEFINE_PROP_UINT32("isobufs", USBHostDevice, iso_urb_count, 4),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void usb_host_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->init = usb_host_initfn;
@@ -1414,27 +1425,20 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
uc->handle_control = usb_host_handle_control;
uc->handle_reset = usb_host_handle_reset;
uc->handle_destroy = usb_host_handle_destroy;
+ dc->vmsd = &vmstate_usb_host;
+ dc->props = usb_host_dev_properties;
}
-static struct DeviceInfo usb_host_dev_info = {
- .name = "usb-host",
- .size = sizeof(USBHostDevice),
- .vmsd = &vmstate_usb_host,
- .class_init= usb_host_class_initfn,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("hostbus", USBHostDevice, match.bus_num, 0),
- DEFINE_PROP_UINT32("hostaddr", USBHostDevice, match.addr, 0),
- DEFINE_PROP_STRING("hostport", USBHostDevice, match.port),
- DEFINE_PROP_HEX32("vendorid", USBHostDevice, match.vendor_id, 0),
- DEFINE_PROP_HEX32("productid", USBHostDevice, match.product_id, 0),
- DEFINE_PROP_UINT32("isobufs", USBHostDevice, iso_urb_count, 4),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo usb_host_dev_info = {
+ .name = "usb-host",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBHostDevice),
+ .class_init = usb_host_class_initfn,
};
static void usb_host_register_devices(void)
{
- usb_qdev_register(&usb_host_dev_info);
+ type_register_static(&usb_host_dev_info);
usb_legacy_register("usb-host", "host", usb_host_device_open);
}
device_init(usb_host_register_devices)