hw/usb: Inline usb_new()
Inline the 3 uses of usb_new(). Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20240216110313.17039-11-philmd@linaro.org>
This commit is contained in:
parent
8bf6275f7e
commit
8d2701072e
@ -662,7 +662,8 @@ 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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -579,11 +579,6 @@ void usb_pcap_init(FILE *fp);
|
||||
void usb_pcap_ctrl(USBPacket *p, bool setup);
|
||||
void usb_pcap_data(USBPacket *p, bool setup);
|
||||
|
||||
static inline USBDevice *usb_new(const char *name)
|
||||
{
|
||||
return USB_DEVICE(qdev_new(name));
|
||||
}
|
||||
|
||||
static inline bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp)
|
||||
{
|
||||
return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
|
||||
@ -591,7 +586,7 @@ static inline bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **er
|
||||
|
||||
static inline 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user