[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/34] hw/usb/uhci: Rename NB_PORTS -> UHCI_PORTS
From: |
Michael Tokarev |
Subject: |
[PULL 02/34] hw/usb/uhci: Rename NB_PORTS -> UHCI_PORTS |
Date: |
Thu, 22 Feb 2024 14:25:29 +0300 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Rename NB_PORTS as UHCI_PORTS to avoid definition clash
with EHCI equivalent:
hw/usb/hcd-uhci.h:38:9: error: 'NB_PORTS' macro redefined
[-Werror,-Wmacro-redefined]
#define NB_PORTS 2
^
hw/usb/hcd-ehci.h:40:9: note: previous definition is here
#define NB_PORTS 6 /* Max. Number of downstream ports */
^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
hw/usb/hcd-uhci.c | 22 +++++++++++-----------
hw/usb/hcd-uhci.h | 4 ++--
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index b95b47f6a4..a03cf22e69 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -322,7 +322,7 @@ static void uhci_reset(DeviceState *dev)
s->fl_base_addr = 0;
s->sof_timing = 64;
- for(i = 0; i < NB_PORTS; i++) {
+ for(i = 0; i < UHCI_PORTS; i++) {
port = &s->ports[i];
port->ctrl = 0x0080;
if (port->port.dev && port->port.dev->attached) {
@@ -364,7 +364,7 @@ static const VMStateDescription vmstate_uhci = {
.fields = (const VMStateField[]) {
VMSTATE_PCI_DEVICE(dev, UHCIState),
VMSTATE_UINT8_EQUAL(num_ports_vmstate, UHCIState, NULL),
- VMSTATE_STRUCT_ARRAY(ports, UHCIState, NB_PORTS, 1,
+ VMSTATE_STRUCT_ARRAY(ports, UHCIState, UHCI_PORTS, 1,
vmstate_uhci_port, UHCIPort),
VMSTATE_UINT16(cmd, UHCIState),
VMSTATE_UINT16(status, UHCIState),
@@ -404,7 +404,7 @@ static void uhci_port_write(void *opaque, hwaddr addr,
int i;
/* send reset on the USB bus */
- for(i = 0; i < NB_PORTS; i++) {
+ for(i = 0; i < UHCI_PORTS; i++) {
port = &s->ports[i];
usb_device_reset(port->port.dev);
}
@@ -457,7 +457,7 @@ static void uhci_port_write(void *opaque, hwaddr addr,
int n;
n = (addr >> 1) & 7;
- if (n >= NB_PORTS) {
+ if (n >= UHCI_PORTS) {
return;
}
port = &s->ports[n];
@@ -514,7 +514,7 @@ static uint64_t uhci_port_read(void *opaque, hwaddr addr,
unsigned size)
UHCIPort *port;
int n;
n = (addr >> 1) & 7;
- if (n >= NB_PORTS) {
+ if (n >= UHCI_PORTS) {
goto read_default;
}
port = &s->ports[n];
@@ -609,7 +609,7 @@ static USBDevice *uhci_find_device(UHCIState *s, uint8_t
addr)
USBDevice *dev;
int i;
- for (i = 0; i < NB_PORTS; i++) {
+ for (i = 0; i < UHCI_PORTS; i++) {
UHCIPort *port = &s->ports[i];
if (!(port->ctrl & UHCI_PORT_EN)) {
continue;
@@ -1173,11 +1173,11 @@ void usb_uhci_common_realize(PCIDevice *dev, Error
**errp)
s->irq = pci_allocate_irq(dev);
if (s->masterbus) {
- USBPort *ports[NB_PORTS];
- for(i = 0; i < NB_PORTS; i++) {
+ USBPort *ports[UHCI_PORTS];
+ for(i = 0; i < UHCI_PORTS; i++) {
ports[i] = &s->ports[i].port;
}
- usb_register_companion(s->masterbus, ports, NB_PORTS,
+ usb_register_companion(s->masterbus, ports, UHCI_PORTS,
s->firstport, s, &uhci_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL,
&err);
@@ -1187,14 +1187,14 @@ void usb_uhci_common_realize(PCIDevice *dev, Error
**errp)
}
} else {
usb_bus_new(&s->bus, sizeof(s->bus), &uhci_bus_ops, DEVICE(dev));
- for (i = 0; i < NB_PORTS; i++) {
+ for (i = 0; i < UHCI_PORTS; i++) {
usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
}
}
s->bh = qemu_bh_new_guarded(uhci_bh, s,
&DEVICE(dev)->mem_reentrancy_guard);
s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, uhci_frame_timer, s);
- s->num_ports_vmstate = NB_PORTS;
+ s->num_ports_vmstate = UHCI_PORTS;
QTAILQ_INIT(&s->queues);
memory_region_init_io(&s->io_bar, OBJECT(s), &uhci_ioport_ops, s,
diff --git a/hw/usb/hcd-uhci.h b/hw/usb/hcd-uhci.h
index 69f8b40c49..6d26b94e92 100644
--- a/hw/usb/hcd-uhci.h
+++ b/hw/usb/hcd-uhci.h
@@ -35,7 +35,7 @@
typedef struct UHCIQueue UHCIQueue;
-#define NB_PORTS 2
+#define UHCI_PORTS 2
typedef struct UHCIPort {
USBPort port;
@@ -59,7 +59,7 @@ typedef struct UHCIState {
uint32_t frame_bytes;
uint32_t frame_bandwidth;
bool completions_only;
- UHCIPort ports[NB_PORTS];
+ UHCIPort ports[UHCI_PORTS];
qemu_irq irq;
/* Interrupts that should be raised at the end of the current frame. */
uint32_t pending_int_mask;
--
2.39.2
- [PULL 00/34] Trivial patches for 2024-02-22, Michael Tokarev, 2024/02/22
- [PULL 02/34] hw/usb/uhci: Rename NB_PORTS -> UHCI_PORTS,
Michael Tokarev <=
- [PULL 09/34] hw/i386/port92: Add missing 'hw/isa/isa.h' header, Michael Tokarev, 2024/02/22
- [PULL 05/34] target/i386/monitor: Remove unused 'hw/i386/pc.h' header, Michael Tokarev, 2024/02/22
- [PULL 01/34] hw/usb: Style cleanup, Michael Tokarev, 2024/02/22
- [PULL 08/34] hw/i386/acpi: Declare pc_madt_cpu_entry() in 'acpi-common.h', Michael Tokarev, 2024/02/22
- [PULL 04/34] hw/i386/kvm/ioapic: Replace magic '24' value by proper definition, Michael Tokarev, 2024/02/22
- [PULL 06/34] hw/timer: Move HPET_INTCAP definition to "hpet.h", Michael Tokarev, 2024/02/22
- [PULL 03/34] hw/usb/ehci: Rename NB_PORTS -> EHCI_PORTS, Michael Tokarev, 2024/02/22
- [PULL 07/34] hw/isa/lpc_ich9: Remove unused 'hw/i386/pc.h', Michael Tokarev, 2024/02/22
- [PULL 11/34] hw/acpi/cpu_hotplug: Include 'x86.h' instead of 'pc.h', Michael Tokarev, 2024/02/22
- [PULL 10/34] hw/acpi/cpu_hotplug: Include 'pci_device.h' instead of 'pci.h', Michael Tokarev, 2024/02/22