From ba02430f1a681173cff5336c626d6edc5ea268db Mon Sep 17 00:00:00 2001 From: Anthony Liguori Date: Thu, 8 Dec 2011 14:56:53 -0600 Subject: usb: separate out legacy usb registration from type registration Type registeration is going to get turned into a QOM call so decouple the legacy support. Signed-off-by: Anthony Liguori --- hw/usb-bus.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'hw/usb-bus.c') diff --git a/hw/usb-bus.c b/hw/usb-bus.c index aeef908..6b0adfd 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; -- cgit v1.1