[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/13] usb: remove support for -usbdevice parameters
From: |
Gerd Hoffmann |
Subject: |
[PULL 02/13] usb: remove support for -usbdevice parameters |
Date: |
Mon, 15 Mar 2021 19:02:29 +0100 |
From: Paolo Bonzini <pbonzini@redhat.com>
No device needs them anymore and in fact they're undocumented.
Remove the code. The only change in behavior is that "-usbdevice
braille:hello" now reports an error, which is a bugfix.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210310173323.1422754-2-thuth@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
include/hw/usb.h | 2 +-
hw/usb/bus.c | 32 +++++++-------------------------
hw/usb/dev-serial.c | 2 +-
3 files changed, 9 insertions(+), 27 deletions(-)
diff --git a/include/hw/usb.h b/include/hw/usb.h
index 9f42394efaea..436e07b30404 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -499,7 +499,7 @@ void usb_bus_new(USBBus *bus, size_t bus_size,
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)(const char *params));
+ 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);
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index df7411fea8e4..07083349f51b 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -310,13 +310,13 @@ typedef struct LegacyUSBFactory
{
const char *name;
const char *usbdevice_name;
- USBDevice *(*usbdevice_init)(const char *params);
+ USBDevice *(*usbdevice_init)(void);
} LegacyUSBFactory;
static GSList *legacy_usb_factory;
void usb_legacy_register(const char *typename, const char *usbdevice_name,
- USBDevice *(*usbdevice_init)(const char *params))
+ USBDevice *(*usbdevice_init)(void))
{
if (usbdevice_name) {
LegacyUSBFactory *f = g_malloc0(sizeof(*f));
@@ -658,27 +658,17 @@ void hmp_info_usb(Monitor *mon, const QDict *qdict)
}
/* handle legacy -usbdevice cmd line option */
-USBDevice *usbdevice_create(const char *cmdline)
+USBDevice *usbdevice_create(const char *driver)
{
USBBus *bus = usb_bus_find(-1 /* any */);
LegacyUSBFactory *f = NULL;
Error *err = NULL;
GSList *i;
- char driver[32];
- const char *params;
- int len;
USBDevice *dev;
- params = strchr(cmdline,':');
- if (params) {
- params++;
- len = params - cmdline;
- if (len > sizeof(driver))
- len = sizeof(driver);
- pstrcpy(driver, len, cmdline);
- } else {
- params = "";
- pstrcpy(driver, sizeof(driver), cmdline);
+ if (strchr(driver, ':')) {
+ error_report("usbdevice parameters are not supported anymore");
+ return NULL;
}
for (i = legacy_usb_factory; i; i = i->next) {
@@ -702,15 +692,7 @@ USBDevice *usbdevice_create(const char *cmdline)
return NULL;
}
- if (f->usbdevice_init) {
- dev = f->usbdevice_init(params);
- } else {
- if (*params) {
- error_report("usbdevice %s accepts no params", driver);
- return NULL;
- }
- dev = usb_new(f->name);
- }
+ dev = f->usbdevice_init ? f->usbdevice_init() : usb_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 b58c4eb90822..63047d79cfd1 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -614,7 +614,7 @@ static void usb_serial_realize(USBDevice *dev, Error **errp)
s->intr = usb_ep_get(dev, USB_TOKEN_IN, 1);
}
-static USBDevice *usb_braille_init(const char *unused)
+static USBDevice *usb_braille_init(void)
{
USBDevice *dev;
Chardev *cdrv;
--
2.29.2
- [PULL 07/13] hw/usb/hcd-uhci: Expose generic prototypes to local header, (continued)
- [PULL 07/13] hw/usb/hcd-uhci: Expose generic prototypes to local header, Gerd Hoffmann, 2021/03/15
- [PULL 13/13] usb/storage: clear csw on reset, Gerd Hoffmann, 2021/03/15
- [PULL 01/13] hw/usb/bus: Remove the "full-path" property, Gerd Hoffmann, 2021/03/15
- [PULL 06/13] hw/southbridge: Add missing Kconfig dependency VT82C686 on USB_UHCI, Gerd Hoffmann, 2021/03/15
- [PULL 10/13] usb/storage: move usb-bot device to separate source file, Gerd Hoffmann, 2021/03/15
- [PULL 12/13] usb/storage: add kconfig symbols, Gerd Hoffmann, 2021/03/15
- [PULL 11/13] usb/storage move usb-storage device to separate source file, Gerd Hoffmann, 2021/03/15
- [PULL 08/13] hw/usb: Extract VT82C686 UHCI PCI function into a new unit, Gerd Hoffmann, 2021/03/15
- [PULL 05/13] usb: Document the missing -usbdevice options, Gerd Hoffmann, 2021/03/15
- [PULL 09/13] usb/storage: move declarations to usb/msd.h header, Gerd Hoffmann, 2021/03/15
- [PULL 02/13] usb: remove support for -usbdevice parameters,
Gerd Hoffmann <=
- Re: [PULL 00/13] Usb 20210315 patches, Peter Maydell, 2021/03/16