summaryrefslogtreecommitdiff
path: root/usb-linux.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-15 14:53:10 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-01-27 10:50:47 -0600
commit62aed76583fe8bf8e6ba5955b2ecfa3619ea3540 (patch)
treea536e59eab00a94fccfbb8b3ad8b32e902e77ea2 /usb-linux.c
parent8f04ee0882aec9fe91fb70f767edf5dacff59835 (diff)
downloadqemu-62aed76583fe8bf8e6ba5955b2ecfa3619ea3540.tar.gz
usb: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'usb-linux.c')
-rw-r--r--usb-linux.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/usb-linux.c b/usb-linux.c
index 56898dd4cd..31810f6f40 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1402,21 +1402,26 @@ static const VMStateDescription vmstate_usb_host = {
.unmigratable = 1,
};
-static struct USBDeviceInfo usb_host_dev_info = {
- .product_desc = "USB Host Device",
- .qdev.name = "usb-host",
- .qdev.size = sizeof(USBHostDevice),
- .qdev.vmsd = &vmstate_usb_host,
- .init = usb_host_initfn,
- .handle_packet = usb_generic_handle_packet,
- .cancel_packet = usb_host_async_cancel,
- .handle_data = usb_host_handle_data,
- .handle_control = usb_host_handle_control,
- .handle_reset = usb_host_handle_reset,
- .handle_destroy = usb_host_handle_destroy,
- .usbdevice_name = "host",
- .usbdevice_init = usb_host_device_open,
- .qdev.props = (Property[]) {
+static void usb_host_class_initfn(ObjectClass *klass, void *data)
+{
+ USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
+
+ uc->init = usb_host_initfn;
+ uc->product_desc = "USB Host Device";
+ uc->handle_packet = usb_generic_handle_packet;
+ uc->cancel_packet = usb_host_async_cancel;
+ uc->handle_data = usb_host_handle_data;
+ uc->handle_control = usb_host_handle_control;
+ uc->handle_reset = usb_host_handle_reset;
+ uc->handle_destroy = usb_host_handle_destroy;
+}
+
+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),
@@ -1429,7 +1434,7 @@ static struct USBDeviceInfo usb_host_dev_info = {
static void usb_host_register_devices(void)
{
- usb_qdev_register(&usb_host_dev_info);
+ usb_qdev_register(&usb_host_dev_info, "host", usb_host_device_open);
}
device_init(usb_host_register_devices)