From nobody Tue Nov 26 10:28:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708601502107201.72518831209413; Thu, 22 Feb 2024 03:31:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rd7E6-0008CW-5q; Thu, 22 Feb 2024 06:26:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rd7DW-00083k-2I; Thu, 22 Feb 2024 06:26:18 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rd7DT-0004rV-Ka; Thu, 22 Feb 2024 06:26:17 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 8F1D64FB45; Thu, 22 Feb 2024 14:26:25 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 14A4A87171; Thu, 22 Feb 2024 14:26:02 +0300 (MSK) Received: (nullmailer pid 2526149 invoked by uid 1000); Thu, 22 Feb 2024 11:26:01 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, Michael Tokarev Subject: [PULL 03/34] hw/usb/ehci: Rename NB_PORTS -> EHCI_PORTS Date: Thu, 22 Feb 2024 14:25:30 +0300 Message-Id: <20240222112601.2526057-4-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222112601.2526057-1-mjt@tls.msk.ru> References: <20240222112601.2526057-1-mjt@tls.msk.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1708601503425100004 From: Philippe Mathieu-Daud=C3=A9 Rename NB_PORTS as EHCI_PORTS to avoid definition clash with UHCI equivalent: hw/usb/hcd-ehci.h:40:9: error: 'NB_PORTS' macro redefined [-Werror,-Wmacr= o-redefined] #define NB_PORTS 6 /* Max. Number of downstream ports */ ^ hw/usb/hcd-uhci.h:38:9: note: previous definition is here #define NB_PORTS 2 ^ Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Signed-off-by: Michael Tokarev --- hw/usb/hcd-ehci-pci.c | 2 +- hw/usb/hcd-ehci-sysbus.c | 2 +- hw/usb/hcd-ehci.c | 20 ++++++++++---------- hw/usb/hcd-ehci.h | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c index 0b26db74d8..3ff54edf62 100644 --- a/hw/usb/hcd-ehci-pci.c +++ b/hw/usb/hcd-ehci-pci.c @@ -83,7 +83,7 @@ static void usb_ehci_pci_init(Object *obj) s->capsbase =3D 0x00; s->opregbase =3D 0x20; s->portscbase =3D 0x44; - s->portnr =3D NB_PORTS; + s->portnr =3D EHCI_PORTS; =20 if (!dc->hotpluggable) { s->companion_enable =3D true; diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c index bfb774504c..fe1dabd0bb 100644 --- a/hw/usb/hcd-ehci-sysbus.c +++ b/hw/usb/hcd-ehci-sysbus.c @@ -88,7 +88,7 @@ static void ehci_sysbus_class_init(ObjectClass *klass, vo= id *data) SysBusEHCIClass *sec =3D SYS_BUS_EHCI_CLASS(klass); =20 sec->portscbase =3D 0x44; - sec->portnr =3D NB_PORTS; + sec->portnr =3D EHCI_PORTS; =20 dc->realize =3D usb_ehci_sysbus_realize; dc->vmsd =3D &vmstate_ehci_sysbus; diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 98a2860069..01864d4649 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -783,9 +783,9 @@ static void ehci_register_companion(USBBus *bus, USBPor= t *ports[], EHCIState *s =3D container_of(bus, EHCIState, bus); uint32_t i; =20 - if (firstport + portcount > NB_PORTS) { + if (firstport + portcount > EHCI_PORTS) { error_setg(errp, "firstport must be between 0 and %u", - NB_PORTS - portcount); + EHCI_PORTS - portcount); return; } =20 @@ -831,7 +831,7 @@ static USBDevice *ehci_find_device(EHCIState *ehci, uin= t8_t addr) USBPort *port; int i; =20 - for (i =3D 0; i < NB_PORTS; i++) { + for (i =3D 0; i < EHCI_PORTS; i++) { port =3D &ehci->ports[i]; if (!(ehci->portsc[i] & PORTSC_PED)) { DPRINTF("Port %d not enabled\n", i); @@ -850,7 +850,7 @@ void ehci_reset(void *opaque) { EHCIState *s =3D opaque; int i; - USBDevice *devs[NB_PORTS]; + USBDevice *devs[EHCI_PORTS]; =20 trace_usb_ehci_reset(); =20 @@ -858,7 +858,7 @@ void ehci_reset(void *opaque) * Do the detach before touching portsc, so that it correctly gets sen= d to * us or to our companion based on PORTSC_POWNER before the reset. */ - for(i =3D 0; i < NB_PORTS; i++) { + for(i =3D 0; i < EHCI_PORTS; i++) { devs[i] =3D s->ports[i].dev; if (devs[i] && devs[i]->attached) { usb_detach(&s->ports[i]); @@ -877,7 +877,7 @@ void ehci_reset(void *opaque) s->astate =3D EST_INACTIVE; s->pstate =3D EST_INACTIVE; =20 - for(i =3D 0; i < NB_PORTS; i++) { + for(i =3D 0; i < EHCI_PORTS; i++) { if (s->companion_ports[i]) { s->portsc[i] =3D PORTSC_POWNER | PORTSC_PPOWER; } else { @@ -1086,7 +1086,7 @@ static void ehci_opreg_write(void *ptr, hwaddr addr, case CONFIGFLAG: val &=3D 0x1; if (val) { - for (i =3D 0; i < NB_PORTS; i++) { + for (i =3D 0; i < EHCI_PORTS; i++) { handle_port_owner_write(s, i, 0); } } @@ -2427,7 +2427,7 @@ static int usb_ehci_post_load(void *opaque, int versi= on_id) EHCIState *s =3D opaque; int i; =20 - for (i =3D 0; i < NB_PORTS; i++) { + for (i =3D 0; i < EHCI_PORTS; i++) { USBPort *companion =3D s->companion_ports[i]; if (companion =3D=3D NULL) { continue; @@ -2509,9 +2509,9 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev,= Error **errp) { int i; =20 - if (s->portnr > NB_PORTS) { + if (s->portnr > EHCI_PORTS) { error_setg(errp, "Too many ports! Max. port number is %d.", - NB_PORTS); + EHCI_PORTS); return; } if (s->maxframes < 8 || s->maxframes > 512) { diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h index 2cd821f49e..56a1c09d1f 100644 --- a/hw/usb/hcd-ehci.h +++ b/hw/usb/hcd-ehci.h @@ -37,7 +37,7 @@ #define MMIO_SIZE 0x1000 #define CAPA_SIZE 0x10 =20 -#define NB_PORTS 6 /* Max. Number of downstream ports */ +#define EHCI_PORTS 6 /* Max. Number of downstream ports */ =20 typedef struct EHCIPacket EHCIPacket; typedef struct EHCIQueue EHCIQueue; @@ -288,7 +288,7 @@ struct EHCIState { uint32_t configflag; }; }; - uint32_t portsc[NB_PORTS]; + uint32_t portsc[EHCI_PORTS]; =20 /* * Internal states, shadow registers, etc @@ -298,8 +298,8 @@ struct EHCIState { bool working; uint32_t astate; /* Current state in asynchronous schedule */ uint32_t pstate; /* Current state in periodic schedule */ - USBPort ports[NB_PORTS]; - USBPort *companion_ports[NB_PORTS]; + USBPort ports[EHCI_PORTS]; + USBPort *companion_ports[EHCI_PORTS]; uint32_t usbsts_pending; uint32_t usbsts_frindex; EHCIQueueHead aqueues; --=20 2.39.2