From nobody Wed Nov 19 08:46:09 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615398111; cv=none; d=zohomail.com; s=zohoarc; b=QFZzERB4HOjtsuvP8cSsSLcc3fw0YvLS/pEW025srNDv3ZCXzKDJDr8EeNHpTa4seQYSfu9p4Csl0oKNhkuRWB1p0I2Euk9y1r49R5r3QiQS56X+d5ETKzMwQK/p0fE4PDp9jkYxnMILnW7wUQ3Hl3oRkW+gv27QIlKwROiaRrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615398111; 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=+zve30dje/9XnSdNB4el5HXg0L8IB4L2l+Yz29v9zhM=; b=Ve9/uzlrRq/EVenTpdlyxZDLSyZZeu2gi+ha7sb+X9QjGqGnIPSbxaXJsT8P1W/Nr9vO13TuaVm/y57+RKlUDYfbsHOxYbDIQi4AudNYxtPjVhB4Olkq+e3Lz/JwXJ3hpexXMfMgFI2PrAXdITWv8xijdEsiaD+uZcVUReKgqAw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615398111020747.3893449165473; Wed, 10 Mar 2021 09:41:51 -0800 (PST) Received: from localhost ([::1]:54626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lK2qD-0005yK-Rx for importer@patchew.org; Wed, 10 Mar 2021 12:41:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lK2iN-0007hi-0t for qemu-devel@nongnu.org; Wed, 10 Mar 2021 12:33:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55416) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lK2iH-0006yY-7Y for qemu-devel@nongnu.org; Wed, 10 Mar 2021 12:33:42 -0500 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-191-LK4Ejn5GMM2fx0PpjUnjYA-1; Wed, 10 Mar 2021 12:33:34 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 883CF801817; Wed, 10 Mar 2021 17:33:33 +0000 (UTC) Received: from thuth.com (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F1E860C13; Wed, 10 Mar 2021 17:33:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615397616; h=from:from: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; bh=+zve30dje/9XnSdNB4el5HXg0L8IB4L2l+Yz29v9zhM=; b=AZxSLMU3is10lfBt+v4ZKmAWwdRLmH/GTVvEuZ01uutjOBqJZ6yJHjxKWHhAIR6yr8cQOF 1aqi02M+WFl4LRfxWZVQY/n6oqAbzAn5tYTGVyENigA/ykIDOT0xFnRw0Q/s/W/K7zxdLd aSdgGaUc99C23mt63M2bkdeeZGT+4XI= X-MC-Unique: LK4Ejn5GMM2fx0PpjUnjYA-1 From: Thomas Huth To: qemu-devel@nongnu.org, Gerd Hoffmann Subject: [PATCH 1/4] usb: remove support for -usbdevice parameters Date: Wed, 10 Mar 2021 18:33:20 +0100 Message-Id: <20210310173323.1422754-2-thuth@redhat.com> In-Reply-To: <20210310173323.1422754-1-thuth@redhat.com> References: <20210310173323.1422754-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.243, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Markus Armbruster , Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 --- hw/usb/bus.c | 32 +++++++------------------------- hw/usb/dev-serial.c | 2 +- include/hw/usb.h | 2 +- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 064f94e9c3..4b8882427d 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -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; =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)); @@ -663,27 +663,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) { @@ -707,15 +697,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 b58c4eb908..63047d79cf 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; diff --git a/include/hw/usb.h b/include/hw/usb.h index abfbfc5284..08684bcd27 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -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); --=20 2.27.0