diff options
-rw-r--r-- | hw/usb-audio.c | 3 | ||||
-rw-r--r-- | hw/usb-bt.c | 2 | ||||
-rw-r--r-- | hw/usb-bus.c | 22 | ||||
-rw-r--r-- | hw/usb-ccid.c | 3 | ||||
-rw-r--r-- | hw/usb-hid.c | 9 | ||||
-rw-r--r-- | hw/usb-hub.c | 2 | ||||
-rw-r--r-- | hw/usb-msd.c | 3 | ||||
-rw-r--r-- | hw/usb-net.c | 3 | ||||
-rw-r--r-- | hw/usb-serial.c | 6 | ||||
-rw-r--r-- | hw/usb-wacom.c | 3 | ||||
-rw-r--r-- | hw/usb.h | 6 | ||||
-rw-r--r-- | usb-linux.c | 3 |
12 files changed, 39 insertions, 26 deletions
diff --git a/hw/usb-audio.c b/hw/usb-audio.c index 561ae31d25..459f162041 100644 --- a/hw/usb-audio.c +++ b/hw/usb-audio.c @@ -704,7 +704,8 @@ static struct DeviceInfo usb_audio_info = { static void usb_audio_register_devices(void) { - usb_qdev_register(&usb_audio_info, "audio", NULL); + usb_qdev_register(&usb_audio_info); + usb_legacy_register("usb-audio", "audio", NULL); } device_init(usb_audio_register_devices) diff --git a/hw/usb-bt.c b/hw/usb-bt.c index bf8c47076a..f497a446f4 100644 --- a/hw/usb-bt.c +++ b/hw/usb-bt.c @@ -550,6 +550,6 @@ static struct DeviceInfo bt_info = { static void usb_bt_register_devices(void) { - usb_qdev_register(&bt_info, NULL, NULL); + usb_qdev_register(&bt_info); } device_init(usb_bt_register_devices) diff --git a/hw/usb-bus.c b/hw/usb-bus.c index aeef908fe4..6b0adfda19 100644 --- a/hw/usb-bus.c +++ b/hw/usb-bus.c @@ -208,25 +208,27 @@ typedef struct LegacyUSBFactory static GSList *legacy_usb_factory; -void usb_qdev_register(DeviceInfo *info, - const char *usbdevice_name, - USBDevice *(*usbdevice_init)(const char *params)) +void usb_legacy_register(const char *typename, const char *usbdevice_name, + USBDevice *(*usbdevice_init)(const char *params)) { - 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->name; + f->name = typename; f->usbdevice_name = usbdevice_name; f->usbdevice_init = usbdevice_init; legacy_usb_factory = g_slist_append(legacy_usb_factory, f); } } +void usb_qdev_register(DeviceInfo *info) +{ + 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); +} + USBDevice *usb_create(USBBus *bus, const char *name) { DeviceState *dev; diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c index aff81faae9..a261d7d34d 100644 --- a/hw/usb-ccid.c +++ b/hw/usb-ccid.c @@ -1352,6 +1352,7 @@ static TypeInfo ccid_card_type_info = { static void ccid_register_devices(void) { type_register_static(&ccid_card_type_info); - usb_qdev_register(&ccid_info, "ccid", NULL); + usb_qdev_register(&ccid_info); + usb_legacy_register(CCID_DEV_NAME, "ccid", NULL); } device_init(ccid_register_devices) diff --git a/hw/usb-hid.c b/hw/usb-hid.c index 4af27a22dd..669aae4c3c 100644 --- a/hw/usb-hid.c +++ b/hw/usb-hid.c @@ -617,8 +617,11 @@ static struct DeviceInfo usb_keyboard_info = { static void usb_hid_register_devices(void) { - usb_qdev_register(&usb_tablet_info, "tablet", NULL); - usb_qdev_register(&usb_mouse_info, "mouse", NULL); - usb_qdev_register(&usb_keyboard_info, "keyboard", NULL); + usb_qdev_register(&usb_tablet_info); + usb_legacy_register("usb-tablet", "tablet", NULL); + usb_qdev_register(&usb_mouse_info); + usb_legacy_register("usb-mouse", "mouse", NULL); + usb_qdev_register(&usb_keyboard_info); + usb_legacy_register("usb-kbd", "keyboard", NULL); } device_init(usb_hid_register_devices) diff --git a/hw/usb-hub.c b/hw/usb-hub.c index ee4e6a6920..3e33685fa0 100644 --- a/hw/usb-hub.c +++ b/hw/usb-hub.c @@ -557,6 +557,6 @@ static struct DeviceInfo hub_info = { static void usb_hub_register_devices(void) { - usb_qdev_register(&hub_info, NULL, NULL); + usb_qdev_register(&hub_info); } device_init(usb_hub_register_devices) diff --git a/hw/usb-msd.c b/hw/usb-msd.c index ceb01e0eef..19d0d7b8c8 100644 --- a/hw/usb-msd.c +++ b/hw/usb-msd.c @@ -667,6 +667,7 @@ static struct DeviceInfo msd_info = { static void usb_msd_register_devices(void) { - usb_qdev_register(&msd_info, "disk", usb_msd_init); + usb_qdev_register(&msd_info); + usb_legacy_register("usb-storage", "disk", usb_msd_init); } device_init(usb_msd_register_devices) diff --git a/hw/usb-net.c b/hw/usb-net.c index 57b58ac1da..65eee95737 100644 --- a/hw/usb-net.c +++ b/hw/usb-net.c @@ -1413,6 +1413,7 @@ static struct DeviceInfo net_info = { static void usb_net_register_devices(void) { - usb_qdev_register(&net_info, "net", usb_net_init); + usb_qdev_register(&net_info); + usb_legacy_register("usb-net", "net", usb_net_init); } device_init(usb_net_register_devices) diff --git a/hw/usb-serial.c b/hw/usb-serial.c index de49607831..00b4985fd8 100644 --- a/hw/usb-serial.c +++ b/hw/usb-serial.c @@ -622,7 +622,9 @@ static struct DeviceInfo braille_info = { static void usb_serial_register_devices(void) { - usb_qdev_register(&serial_info, "serial", usb_serial_init); - usb_qdev_register(&braille_info, "braille", usb_braille_init); + usb_qdev_register(&serial_info); + usb_legacy_register("usb-serial", "serial", usb_serial_init); + usb_qdev_register(&braille_info); + usb_legacy_register("usb-braille", "braille", usb_braille_init); } device_init(usb_serial_register_devices) diff --git a/hw/usb-wacom.c b/hw/usb-wacom.c index 9b20a3154c..40bb199e88 100644 --- a/hw/usb-wacom.c +++ b/hw/usb-wacom.c @@ -373,6 +373,7 @@ static struct DeviceInfo wacom_info = { static void usb_wacom_register_devices(void) { - usb_qdev_register(&wacom_info, "wacom-tablet", NULL); + usb_qdev_register(&wacom_info); + usb_legacy_register("usb-wacom-tablet", "wacom-tablet", NULL); } device_init(usb_wacom_register_devices) @@ -418,9 +418,9 @@ struct USBBusOps { void usb_bus_new(USBBus *bus, USBBusOps *ops, DeviceState *host); USBBus *usb_bus_find(int busnr); -void usb_qdev_register(DeviceInfo *info, - const char *usbdevice_name, - USBDevice *(*usbdevice_init)(const char *params)); +void usb_qdev_register(DeviceInfo *info); +void usb_legacy_register(const char *typename, const char *usbdevice_name, + USBDevice *(*usbdevice_init)(const char *params)); USBDevice *usb_create(USBBus *bus, const char *name); USBDevice *usb_create_simple(USBBus *bus, const char *name); USBDevice *usbdevice_create(const char *cmdline); diff --git a/usb-linux.c b/usb-linux.c index 31810f6f40..a337db5296 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -1434,7 +1434,8 @@ static struct DeviceInfo usb_host_dev_info = { static void usb_host_register_devices(void) { - usb_qdev_register(&usb_host_dev_info, "host", usb_host_device_open); + usb_qdev_register(&usb_host_dev_info); + usb_legacy_register("usb-host", "host", usb_host_device_open); } device_init(usb_host_register_devices) |