From nobody Mon Feb 9 19:05:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831382; cv=none; d=zohomail.com; s=zohoarc; b=ck4aI4kFznNUY9uyD0X2RSZAtcK2wRz3J/U+de0SQXLONxfuxKZRxHR0eda0j0tB0NzOy7hQR8O5GTb3J+9oM6rrr3CmGQhG6m7iNEH1/JkKuhPU2n9t/lhlhFrv+RdHYUucRo+p+cfWGc8tugo1Gt78OdW8G4C0UBNYeUFoFi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831382; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aA1OmuGwGeb5S9GO0UwDSwAHfUVsIWifVjYQl8QB5Rc=; b=jfC4oUODBZtBOzHUjVHyzTCHoAjVedsZ60zhgyCcNLDNz4JA2UgkJpQ0VoWsBIglkpC47f22m1K1jwbV8iTF7Hh9N6eCLViKjRu1S3rUB8NCmpPoTIj9WB9L21um2xeZP9waqqbYPBuwr+j9s7QYw9OBz/soUw4u8lbdz8DuzFk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615831382335431.237229823833; Mon, 15 Mar 2021 11:03:02 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-q6qxCXfbOxqcI0O5N_GJfA-1; Mon, 15 Mar 2021 14:02:58 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F73C1015C8A; Mon, 15 Mar 2021 18:02:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF7B61045E83; Mon, 15 Mar 2021 18:02:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5B39018155DE; Mon, 15 Mar 2021 18:02:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2nVN007468 for ; Mon, 15 Mar 2021 14:02:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1DF1D19EF2; Mon, 15 Mar 2021 18:02:49 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A1468620DE; Mon, 15 Mar 2021 18:02:42 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1DC7C1800637; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831381; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aA1OmuGwGeb5S9GO0UwDSwAHfUVsIWifVjYQl8QB5Rc=; b=Vgc+S1gE4hpn3jI4K73B7nwzpn6JzOqN5jt9GRabsyhp7tBcLr+o8lQ9KM+KpB+LTJwdQg x4ZnpcTwTnNKwhzRpyRpzsX/OiIO6liczIjOBRDESk5OdqEhIN0yyxsB3XwUaChTgSPVvm SHQPwUhN4/aUWaK9JnDtrO0hg+zwV7Q= X-MC-Unique: q6qxCXfbOxqcI0O5N_GJfA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 02/13] usb: remove support for -usbdevice parameters Date: Mon, 15 Mar 2021 19:02:29 +0100 Message-Id: <20210315180240.1597240-3-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Thomas Huth , libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini 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 Cc: Gerd Hoffmann Signed-off-by: Thomas Huth Message-Id: <20210310173323.1422754-2-thuth@redhat.com> Signed-off-by: Gerd Hoffmann --- 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; =20 static GSList *legacy_usb_factory; =20 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 =3D g_malloc0(sizeof(*f)); @@ -658,27 +658,17 @@ void hmp_info_usb(Monitor *mon, const QDict *qdict) } =20 /* handle legacy -usbdevice cmd line option */ -USBDevice *usbdevice_create(const char *cmdline) +USBDevice *usbdevice_create(const char *driver) { USBBus *bus =3D usb_bus_find(-1 /* any */); LegacyUSBFactory *f =3D NULL; Error *err =3D NULL; GSList *i; - char driver[32]; - const char *params; - int len; USBDevice *dev; =20 - params =3D strchr(cmdline,':'); - if (params) { - params++; - len =3D params - cmdline; - if (len > sizeof(driver)) - len =3D sizeof(driver); - pstrcpy(driver, len, cmdline); - } else { - params =3D ""; - pstrcpy(driver, sizeof(driver), cmdline); + if (strchr(driver, ':')) { + error_report("usbdevice parameters are not supported anymore"); + return NULL; } =20 for (i =3D legacy_usb_factory; i; i =3D i->next) { @@ -702,15 +692,7 @@ USBDevice *usbdevice_create(const char *cmdline) return NULL; } =20 - if (f->usbdevice_init) { - dev =3D f->usbdevice_init(params); - } else { - if (*params) { - error_report("usbdevice %s accepts no params", driver); - return NULL; - } - dev =3D usb_new(f->name); - } + dev =3D 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 =3D usb_ep_get(dev, USB_TOKEN_IN, 1); } =20 -static USBDevice *usb_braille_init(const char *unused) +static USBDevice *usb_braille_init(void) { USBDevice *dev; Chardev *cdrv; --=20 2.29.2