usb: remove support for -usbdevice parameters
PATCH 1/1 usb: remove support for -usbdevice parameters
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 <[email protected]>
Cc Gerd Hoffmann <[email protected]>
---
Based-on: <[email protected]>
--- hw/usb/bus.c | 32 +++++++------------------------- hw/usb/dev-serial.c | 2 +- include/hw/usb.h | 2 +- 3 files changed, 9 insertions(+), 27 deletions(-)
hw/usb/bus.c +7 -25
@@ -312,13 +312,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));
@@ -663,27 +663,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) {
@@ -707,15 +697,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 ;
hw/usb/dev-serial.c +1 -1
@@ -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;
include/hw/usb.h +1 -1
@@ -500,7 +500,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);
Signature · 1 line
2.29.2