Message ID | 20240216110313.17039-11-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw: More QDev cleanups | expand |
On Fri, Feb 16, 2024 at 12:03:01PM +0100, Philippe Mathieu-Daudé wrote: > Date: Fri, 16 Feb 2024 12:03:01 +0100 > From: Philippe Mathieu-Daudé <philmd@linaro.org> > Subject: [PATCH 10/21] hw/usb: Inline usb_new() > X-Mailer: git-send-email 2.41.0 > > Inline the 2 uses of usb_new(). > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > include/hw/usb.h | 1 - > hw/usb/bus.c | 9 ++------- > hw/usb/dev-serial.c | 2 +- > 3 files changed, 3 insertions(+), 9 deletions(-) Reviewed-by: Zhao Liu <zhao1.liu@intel.com> > > diff --git a/include/hw/usb.h b/include/hw/usb.h > index 32c23a5ca2..2d820685cc 100644 > --- a/include/hw/usb.h > +++ b/include/hw/usb.h > @@ -500,7 +500,6 @@ void usb_bus_release(USBBus *bus); > USBBus *usb_bus_find(int busnr); > void usb_legacy_register(const char *typename, const char *usbdevice_name, > USBDevice *(*usbdevice_init)(void)); > -USBDevice *usb_new(const char *name); > bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp); > USBDevice *usb_create_simple(USBBus *bus, const char *name); > USBDevice *usbdevice_create(const char *cmdline); > diff --git a/hw/usb/bus.c b/hw/usb/bus.c > index 148224f06a..a599e2552b 100644 > --- a/hw/usb/bus.c > +++ b/hw/usb/bus.c > @@ -329,11 +329,6 @@ void usb_legacy_register(const char *typename, const char *usbdevice_name, > } > } > > -USBDevice *usb_new(const char *name) > -{ > - return USB_DEVICE(qdev_new(name)); > -} > - > bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp) > { > return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp); > @@ -341,7 +336,7 @@ bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp) > > USBDevice *usb_create_simple(USBBus *bus, const char *name) > { > - USBDevice *dev = usb_new(name); > + USBDevice *dev = USB_DEVICE(qdev_new(name)); > > usb_realize_and_unref(dev, bus, &error_abort); > return dev; > @@ -693,7 +688,7 @@ USBDevice *usbdevice_create(const char *driver) > return NULL; > } > > - dev = f->usbdevice_init ? f->usbdevice_init() : usb_new(f->name); > + dev = f->usbdevice_init ? f->usbdevice_init() : USB_DEVICE(qdev_new(f->name)); > if (!dev) { > error_report("Failed to create USB device '%s'", f->name); > return NULL; > diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c > index 63047d79cf..6e79c46d53 100644 > --- a/hw/usb/dev-serial.c > +++ b/hw/usb/dev-serial.c > @@ -624,7 +624,7 @@ static USBDevice *usb_braille_init(void) > return NULL; > } > > - dev = usb_new("usb-braille"); > + dev = USB_DEVICE(qdev_new("usb-braille")); > qdev_prop_set_chr(&dev->qdev, "chardev", cdrv); > return dev; > } > -- > 2.41.0 > >
diff --git a/include/hw/usb.h b/include/hw/usb.h index 32c23a5ca2..2d820685cc 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -500,7 +500,6 @@ void usb_bus_release(USBBus *bus); USBBus *usb_bus_find(int busnr); void usb_legacy_register(const char *typename, const char *usbdevice_name, USBDevice *(*usbdevice_init)(void)); -USBDevice *usb_new(const char *name); bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp); USBDevice *usb_create_simple(USBBus *bus, const char *name); USBDevice *usbdevice_create(const char *cmdline); diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 148224f06a..a599e2552b 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -329,11 +329,6 @@ void usb_legacy_register(const char *typename, const char *usbdevice_name, } } -USBDevice *usb_new(const char *name) -{ - return USB_DEVICE(qdev_new(name)); -} - bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp) { return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp); @@ -341,7 +336,7 @@ bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp) USBDevice *usb_create_simple(USBBus *bus, const char *name) { - USBDevice *dev = usb_new(name); + USBDevice *dev = USB_DEVICE(qdev_new(name)); usb_realize_and_unref(dev, bus, &error_abort); return dev; @@ -693,7 +688,7 @@ USBDevice *usbdevice_create(const char *driver) return NULL; } - dev = f->usbdevice_init ? f->usbdevice_init() : usb_new(f->name); + dev = f->usbdevice_init ? f->usbdevice_init() : USB_DEVICE(qdev_new(f->name)); if (!dev) { error_report("Failed to create USB device '%s'", f->name); return NULL; diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 63047d79cf..6e79c46d53 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -624,7 +624,7 @@ static USBDevice *usb_braille_init(void) return NULL; } - dev = usb_new("usb-braille"); + dev = USB_DEVICE(qdev_new("usb-braille")); qdev_prop_set_chr(&dev->qdev, "chardev", cdrv); return dev; }
Inline the 2 uses of usb_new(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/hw/usb.h | 1 - hw/usb/bus.c | 9 ++------- hw/usb/dev-serial.c | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-)