diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-06-10 07:32:16 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-06-15 22:05:28 +0200 |
commit | 590ce74a08d5b4fb39ac165a4fb68bd07e6d2b6c (patch) | |
tree | 22d63bcd8ac233c82139e9dd4f5ddee83f962ac3 /hw/usb/bus.c | |
parent | 32aaaebe5665a75f8be8d76ba3ecfcf87627858b (diff) |
usb: Convert uses of usb_create()
Replace
dev = usb_create(bus, type_name);
...
object_property_set_bool(OBJECT(dev), true, "realized", &err);
by
dev = isa_new(type_name);
...
usb_realize_and_unref(dev, bus, &err);
Recent commit "qdev: New qdev_new(), qdev_realize(), etc." explains
why.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-28-armbru@redhat.com>
Diffstat (limited to 'hw/usb/bus.c')
-rw-r--r-- | hw/usb/bus.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 6b0d9f9e4d..da85b8b005 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -296,14 +296,13 @@ typedef struct LegacyUSBFactory { const char *name; const char *usbdevice_name; - USBDevice *(*usbdevice_init)(USBBus *bus, const char *params); + USBDevice *(*usbdevice_init)(const char *params); } LegacyUSBFactory; static GSList *legacy_usb_factory; void usb_legacy_register(const char *typename, const char *usbdevice_name, - USBDevice *(*usbdevice_init)(USBBus *bus, - const char *params)) + USBDevice *(*usbdevice_init)(const char *params)) { if (usbdevice_name) { LegacyUSBFactory *f = g_malloc0(sizeof(*f)); @@ -710,19 +709,19 @@ USBDevice *usbdevice_create(const char *cmdline) } if (f->usbdevice_init) { - dev = f->usbdevice_init(bus, params); + dev = f->usbdevice_init(params); } else { if (*params) { error_report("usbdevice %s accepts no params", driver); return NULL; } - dev = usb_create(bus, f->name); + dev = usb_new(f->name); } if (!dev) { error_report("Failed to create USB device '%s'", f->name); return NULL; } - object_property_set_bool(OBJECT(dev), true, "realized", &err); + usb_realize_and_unref(dev, bus, &err); if (err) { error_reportf_err(err, "Failed to initialize USB device '%s': ", f->name); |