Patchwork [v3,048/197] usb: kill USBDeviceInfo

login
register
mail settings
Submitter Anthony Liguori
Date Dec. 12, 2011, 8:18 p.m.
Message ID <1323721273-32404-49-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/130874/
State New
Headers show

Comments

Anthony Liguori - Dec. 12, 2011, 8:18 p.m.
---
 hw/usb-bt.c     |   10 +++++-----
 hw/usb-bus.c    |   14 +++++++-------
 hw/usb-ccid.c   |   14 +++++++-------
 hw/usb-hid.c    |   30 +++++++++++++++---------------
 hw/usb-hub.c    |   12 ++++++------
 hw/usb-msd.c    |   14 +++++++-------
 hw/usb-net.c    |   14 +++++++-------
 hw/usb-serial.c |   24 ++++++++++++------------
 hw/usb-wacom.c  |   12 ++++++------
 hw/usb.h        |    7 +------
 usb-bsd.c       |    8 ++++----
 usb-linux.c     |   12 ++++++------
 usb-redir.c     |   10 +++++-----
 13 files changed, 88 insertions(+), 93 deletions(-)

Patch

diff --git a/hw/usb-bt.c b/hw/usb-bt.c
index 8dea574..6e210ac 100644
--- a/hw/usb-bt.c
+++ b/hw/usb-bt.c
@@ -563,11 +563,11 @@  static void usb_bt_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_bt_handle_destroy;
 }
 
-static struct USBDeviceInfo bt_info = {
-    .qdev.name      = "usb-bt-dongle",
-    .qdev.size      = sizeof(struct USBBtState),
-    .qdev.vmsd      = &vmstate_usb_bt,
-    .qdev.class_init= usb_bt_class_initfn,
+static struct DeviceInfo bt_info = {
+    .name      = "usb-bt-dongle",
+    .size      = sizeof(struct USBBtState),
+    .vmsd      = &vmstate_usb_bt,
+    .class_init= usb_bt_class_initfn,
 };
 
 static void usb_bt_register_devices(void)
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index b86d6c8..0e635c2 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -200,19 +200,19 @@  typedef struct LegacyUSBFactory
 
 static GSList *legacy_usb_factory;
 
-void usb_qdev_register(USBDeviceInfo *info,
+void usb_qdev_register(DeviceInfo *info,
                        const char *usbdevice_name,
                        USBDevice *(*usbdevice_init)(const char *params))
 {
-    info->qdev.bus_info = &usb_bus_info;
-    info->qdev.init     = usb_qdev_init;
-    info->qdev.unplug   = qdev_simple_unplug_cb;
-    info->qdev.exit     = usb_qdev_exit;
-    qdev_register_subclass(&info->qdev, TYPE_USB_DEVICE);
+    info->bus_info = &usb_bus_info;
+    info->init     = usb_qdev_init;
+    info->unplug   = qdev_simple_unplug_cb;
+    info->exit     = usb_qdev_exit;
+    qdev_register_subclass(info, TYPE_USB_DEVICE);
 
     if (usbdevice_name) {
         LegacyUSBFactory *f = g_malloc0(sizeof(*f));
-        f->name = info->qdev.name;
+        f->name = info->name;
         f->usbdevice_name = usbdevice_name;
         f->usbdevice_init = usbdevice_init;
         legacy_usb_factory = g_slist_append(legacy_usb_factory, f);
diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c
index 24b1a1f..41a53aa 100644
--- a/hw/usb-ccid.c
+++ b/hw/usb-ccid.c
@@ -1308,13 +1308,13 @@  static void ccid_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = ccid_handle_destroy;
 }
 
-static struct USBDeviceInfo ccid_info = {
-    .qdev.name      = CCID_DEV_NAME,
-    .qdev.desc      = "CCID Rev 1.1 smartcard reader",
-    .qdev.size      = sizeof(USBCCIDState),
-    .qdev.class_init= ccid_class_initfn,
-    .qdev.vmsd      = &ccid_vmstate,
-    .qdev.props     = (Property[]) {
+static struct DeviceInfo ccid_info = {
+    .name      = CCID_DEV_NAME,
+    .desc      = "CCID Rev 1.1 smartcard reader",
+    .size      = sizeof(USBCCIDState),
+    .class_init= ccid_class_initfn,
+    .vmsd      = &ccid_vmstate,
+    .props     = (Property[]) {
         DEFINE_PROP_UINT8("debug", USBCCIDState, debug, 0),
         DEFINE_PROP_END_OF_LIST(),
     },
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 75642cf..2538b9c 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -574,11 +574,11 @@  static void usb_tablet_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_hid_handle_destroy;
 }
 
-static struct USBDeviceInfo usb_tablet_info = {
-    .qdev.name      = "usb-tablet",
-    .qdev.size      = sizeof(USBHIDState),
-    .qdev.vmsd      = &vmstate_usb_ptr,
-    .qdev.class_init= usb_tablet_class_initfn,
+static struct DeviceInfo usb_tablet_info = {
+    .name      = "usb-tablet",
+    .size      = sizeof(USBHIDState),
+    .vmsd      = &vmstate_usb_ptr,
+    .class_init= usb_tablet_class_initfn,
 };
 
 static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
@@ -595,11 +595,11 @@  static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_hid_handle_destroy;
 }
 
-static struct USBDeviceInfo usb_mouse_info = {
-    .qdev.name      = "usb-mouse",
-    .qdev.size      = sizeof(USBHIDState),
-    .qdev.vmsd      = &vmstate_usb_ptr,
-    .qdev.class_init= usb_mouse_class_initfn,
+static struct DeviceInfo usb_mouse_info = {
+    .name      = "usb-mouse",
+    .size      = sizeof(USBHIDState),
+    .vmsd      = &vmstate_usb_ptr,
+    .class_init= usb_mouse_class_initfn,
 };
 
 static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
@@ -616,11 +616,11 @@  static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_hid_handle_destroy;
 }
 
-static struct USBDeviceInfo usb_keyboard_info = {
-    .qdev.name      = "usb-kbd",
-    .qdev.size      = sizeof(USBHIDState),
-    .qdev.vmsd      = &vmstate_usb_kbd,
-    .qdev.class_init= usb_keyboard_class_initfn,
+static struct DeviceInfo usb_keyboard_info = {
+    .name      = "usb-kbd",
+    .size      = sizeof(USBHIDState),
+    .vmsd      = &vmstate_usb_kbd,
+    .class_init= usb_keyboard_class_initfn,
 };
 
 static void usb_hid_register_devices(void)
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index b5114dd..f997152 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -554,12 +554,12 @@  static void  usb_hub_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_hub_handle_destroy;
 }
 
-static struct USBDeviceInfo hub_info = {
-    .qdev.name      = "usb-hub",
-    .qdev.fw_name   = "hub",
-    .qdev.size      = sizeof(USBHubState),
-    .qdev.vmsd      = &vmstate_usb_hub,
-    .qdev.class_init= usb_hub_class_initfn,
+static struct DeviceInfo hub_info = {
+    .name      = "usb-hub",
+    .fw_name   = "hub",
+    .size      = sizeof(USBHubState),
+    .vmsd      = &vmstate_usb_hub,
+    .class_init= usb_hub_class_initfn,
 };
 
 static void usb_hub_register_devices(void)
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index a6226b4..e4a1e4e 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -649,13 +649,13 @@  static void usb_msd_class_initfn(ObjectClass *klass, void *data)
     uc->handle_data    = usb_msd_handle_data;
 }
 
-static struct USBDeviceInfo msd_info = {
-    .qdev.name      = "usb-storage",
-    .qdev.fw_name   = "storage",
-    .qdev.size      = sizeof(MSDState),
-    .qdev.vmsd      = &vmstate_usb_msd,
-    .qdev.class_init= usb_msd_class_initfn,
-    .qdev.props     = (Property[]) {
+static struct DeviceInfo msd_info = {
+    .name      = "usb-storage",
+    .fw_name   = "storage",
+    .size      = sizeof(MSDState),
+    .vmsd      = &vmstate_usb_msd,
+    .class_init= usb_msd_class_initfn,
+    .props     = (Property[]) {
         DEFINE_BLOCK_PROPERTIES(MSDState, conf),
         DEFINE_PROP_STRING("serial", MSDState, serial),
         DEFINE_PROP_BIT("removable", MSDState, removable, 0, false),
diff --git a/hw/usb-net.c b/hw/usb-net.c
index 1f14b27..61a8e86 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1412,13 +1412,13 @@  static void usb_net_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_net_handle_destroy;
 }
 
-static struct USBDeviceInfo net_info = {
-    .qdev.name      = "usb-net",
-    .qdev.fw_name   = "network",
-    .qdev.size      = sizeof(USBNetState),
-    .qdev.vmsd      = &vmstate_usb_net,
-    .qdev.class_init= usb_net_class_initfn,
-    .qdev.props     = (Property[]) {
+static struct DeviceInfo net_info = {
+    .name      = "usb-net",
+    .fw_name   = "network",
+    .size      = sizeof(USBNetState),
+    .vmsd      = &vmstate_usb_net,
+    .class_init= usb_net_class_initfn,
+    .props     = (Property[]) {
         DEFINE_NIC_PROPERTIES(USBNetState, conf),
         DEFINE_PROP_END_OF_LIST(),
     },
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 407ca72..73bb80b 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -591,12 +591,12 @@  static void usb_serial_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_serial_handle_destroy;
 }
 
-static struct USBDeviceInfo serial_info = {
-    .qdev.name      = "usb-serial",
-    .qdev.size      = sizeof(USBSerialState),
-    .qdev.vmsd      = &vmstate_usb_serial,
-    .qdev.class_init= usb_serial_class_initfn,
-    .qdev.props     = (Property[]) {
+static struct DeviceInfo serial_info = {
+    .name      = "usb-serial",
+    .size      = sizeof(USBSerialState),
+    .vmsd      = &vmstate_usb_serial,
+    .class_init= usb_serial_class_initfn,
+    .props     = (Property[]) {
         DEFINE_PROP_CHR("chardev", USBSerialState, cs),
         DEFINE_PROP_END_OF_LIST(),
     },
@@ -616,12 +616,12 @@  static void usb_braille_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_serial_handle_destroy;
 }
 
-static struct USBDeviceInfo braille_info = {
-    .qdev.name      = "usb-braille",
-    .qdev.size      = sizeof(USBSerialState),
-    .qdev.vmsd      = &vmstate_usb_serial,
-    .qdev.class_init= usb_braille_class_initfn,
-    .qdev.props     = (Property[]) {
+static struct DeviceInfo braille_info = {
+    .name      = "usb-braille",
+    .size      = sizeof(USBSerialState),
+    .vmsd      = &vmstate_usb_serial,
+    .class_init= usb_braille_class_initfn,
+    .props     = (Property[]) {
         DEFINE_PROP_CHR("chardev", USBSerialState, cs),
         DEFINE_PROP_END_OF_LIST(),
     },
diff --git a/hw/usb-wacom.c b/hw/usb-wacom.c
index 4a671ef..12c949f 100644
--- a/hw/usb-wacom.c
+++ b/hw/usb-wacom.c
@@ -370,12 +370,12 @@  static void usb_wacom_class_init(ObjectClass *class, void *data)
     uc->handle_destroy = usb_wacom_handle_destroy;
 }
 
-static struct USBDeviceInfo wacom_info = {
-    .qdev.name      = "usb-wacom-tablet",
-    .qdev.desc      = "QEMU PenPartner Tablet",
-    .qdev.size      = sizeof(USBWacomState),
-    .qdev.vmsd      = &vmstate_usb_wacom,
-    .qdev.class_init= usb_wacom_class_init,
+static struct DeviceInfo wacom_info = {
+    .name      = "usb-wacom-tablet",
+    .desc      = "QEMU PenPartner Tablet",
+    .size      = sizeof(USBWacomState),
+    .vmsd      = &vmstate_usb_wacom,
+    .class_init= usb_wacom_class_init,
 };
 
 static void usb_wacom_register_devices(void)
diff --git a/hw/usb.h b/hw/usb.h
index eac0bf5..2bbfb0a 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -145,7 +145,6 @@  typedef struct USBBus USBBus;
 typedef struct USBBusOps USBBusOps;
 typedef struct USBPort USBPort;
 typedef struct USBDevice USBDevice;
-typedef struct USBDeviceInfo USBDeviceInfo;
 typedef struct USBPacket USBPacket;
 
 typedef struct USBDesc USBDesc;
@@ -256,10 +255,6 @@  struct USBDevice {
     const USBDescConfig *config;
 };
 
-struct USBDeviceInfo {
-    DeviceInfo qdev;
-};
-
 typedef struct USBPortOps {
     void (*attach)(USBPort *port);
     void (*detach)(USBPort *port);
@@ -381,7 +376,7 @@  struct USBBusOps {
 
 void usb_bus_new(USBBus *bus, USBBusOps *ops, DeviceState *host);
 USBBus *usb_bus_find(int busnr);
-void usb_qdev_register(USBDeviceInfo *info,
+void usb_qdev_register(DeviceInfo *info,
                        const char *usbdevice_name,
                        USBDevice *(*usbdevice_init)(const char *params));
 USBDevice *usb_create(USBBus *bus, const char *name);
diff --git a/usb-bsd.c b/usb-bsd.c
index 8637c77..2c6afc8 100644
--- a/usb-bsd.c
+++ b/usb-bsd.c
@@ -410,10 +410,10 @@  static void usb_host_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_host_handle_destroy;
 }
 
-static struct USBDeviceInfo usb_host_dev_info = {
-    .qdev.name      = "usb-host",
-    .qdev.size      = sizeof(USBHostDevice),
-    .qdev.class_init= usb_host_initfn,
+static struct DeviceInfo usb_host_dev_info = {
+    .name      = "usb-host",
+    .size      = sizeof(USBHostDevice),
+    .class_init= usb_host_initfn,
 };
 
 static void usb_host_register_devices(void)
diff --git a/usb-linux.c b/usb-linux.c
index 6dbcf2a..82d7e7e 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1442,12 +1442,12 @@  static void usb_host_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_host_handle_destroy;
 }
 
-static struct USBDeviceInfo usb_host_dev_info = {
-    .qdev.name      = "usb-host",
-    .qdev.size      = sizeof(USBHostDevice),
-    .qdev.vmsd      = &vmstate_usb_host,
-    .qdev.class_init= usb_host_class_initfn,
-    .qdev.props     = (Property[]) {
+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),
diff --git a/usb-redir.c b/usb-redir.c
index a297501..09dc7e6 100644
--- a/usb-redir.c
+++ b/usb-redir.c
@@ -1241,11 +1241,11 @@  static void usbredir_class_initfn(ObjectClass *klass, void *data)
     uc->handle_control = usbredir_handle_control;
 }
 
-static struct USBDeviceInfo usbredir_dev_info = {
-    .qdev.name      = "usb-redir",
-    .qdev.size      = sizeof(USBRedirDevice),
-    .qdev.class_init= usbredir_class_initfn,
-    .qdev.props     = (Property[]) {
+static struct DeviceInfo usbredir_dev_info = {
+    .name      = "usb-redir",
+    .size      = sizeof(USBRedirDevice),
+    .class_init= usbredir_class_initfn,
+    .props     = (Property[]) {
         DEFINE_PROP_CHR("chardev", USBRedirDevice, cs),
         DEFINE_PROP_UINT8("debug", USBRedirDevice, debug, 0),
         DEFINE_PROP_END_OF_LIST(),