On Mon, Oct 09, 2023 at 11:47:45AM +0200, Philippe Mathieu-Daudé wrote: > Fix: > > hw/pci/pci.c:504:54: error: declaration shadows a variable in the global > scope [-Werror,-Wshadow] > MemoryRegion *address_space_io, > ^ > hw/pci/pci.c:533:38: error: declaration shadows a variable in the global > scope [-Werror,-Wshadow] > MemoryRegion *address_space_io, > ^ > hw/pci/pci.c:543:40: error: declaration shadows a variable in the global > scope [-Werror,-Wshadow] > MemoryRegion *address_space_io, > ^ > hw/pci/pci.c:590:45: error: declaration shadows a variable in the global > scope [-Werror,-Wshadow] > MemoryRegion *address_space_io, > ^ > include/exec/address-spaces.h:35:21: note: previous declaration is here > extern AddressSpace address_space_io; > ^ > > Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]> > --- > include/hw/pci/pci.h | 9 +++------ > hw/pci/pci.c | 25 +++++++++---------------- > 2 files changed, 12 insertions(+), 22 deletions(-) > > diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h > index b70a0b95ff..ea5aff118b 100644 > --- a/include/hw/pci/pci.h > +++ b/include/hw/pci/pci.h > @@ -279,12 +279,10 @@ bool pci_bus_is_express(const PCIBus *bus); > > void pci_root_bus_init(PCIBus *bus, size_t bus_size, DeviceState *parent, > const char *name, > - MemoryRegion *address_space_mem, > - MemoryRegion *address_space_io, > + MemoryRegion *mem, MemoryRegion *io, > uint8_t devfn_min, const char *typename); > PCIBus *pci_root_bus_new(DeviceState *parent, const char *name, > - MemoryRegion *address_space_mem, > - MemoryRegion *address_space_io, > + MemoryRegion *mem, MemoryRegion *io, > uint8_t devfn_min, const char *typename); > void pci_root_bus_cleanup(PCIBus *bus); > void pci_bus_irqs(PCIBus *bus, pci_set_irq_fn set_irq, > @@ -304,8 +302,7 @@ int pci_swizzle_map_irq_fn(PCIDevice *pci_dev, int pin); > PCIBus *pci_register_root_bus(DeviceState *parent, const char *name, > pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, > void *irq_opaque, > - MemoryRegion *address_space_mem, > - MemoryRegion *address_space_io, > + MemoryRegion *mem, MemoryRegion *io, > uint8_t devfn_min, int nirq, > const char *typename); > void pci_unregister_root_bus(PCIBus *bus); > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index b0d21bf43a..7d09e1a39d 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -500,15 +500,14 @@ bool pci_bus_bypass_iommu(PCIBus *bus) > } > > static void pci_root_bus_internal_init(PCIBus *bus, DeviceState *parent, > - MemoryRegion *address_space_mem, > - MemoryRegion *address_space_io, > + MemoryRegion *mem, MemoryRegion *io, > uint8_t devfn_min) > { > assert(PCI_FUNC(devfn_min) == 0); > bus->devfn_min = devfn_min; > bus->slot_reserved_mask = 0x0; > - bus->address_space_mem = address_space_mem; > - bus->address_space_io = address_space_io; > + bus->address_space_mem = mem; > + bus->address_space_io = io; > bus->flags |= PCI_BUS_IS_ROOT; > > /* host bridge */ > @@ -529,25 +528,21 @@ bool pci_bus_is_express(const PCIBus *bus) > > void pci_root_bus_init(PCIBus *bus, size_t bus_size, DeviceState *parent, > const char *name, > - MemoryRegion *address_space_mem, > - MemoryRegion *address_space_io, > + MemoryRegion *mem, MemoryRegion *io, > uint8_t devfn_min, const char *typename) > { > qbus_init(bus, bus_size, typename, parent, name); > - pci_root_bus_internal_init(bus, parent, address_space_mem, > - address_space_io, devfn_min); > + pci_root_bus_internal_init(bus, parent, mem, io, devfn_min); > } > > PCIBus *pci_root_bus_new(DeviceState *parent, const char *name, > - MemoryRegion *address_space_mem, > - MemoryRegion *address_space_io, > + MemoryRegion *mem, MemoryRegion *io, > uint8_t devfn_min, const char *typename) > { > PCIBus *bus; > > bus = PCI_BUS(qbus_new(typename, parent, name)); > - pci_root_bus_internal_init(bus, parent, address_space_mem, > - address_space_io, devfn_min); > + pci_root_bus_internal_init(bus, parent, mem, io, devfn_min); > return bus; > } > > @@ -586,15 +581,13 @@ void pci_bus_irqs_cleanup(PCIBus *bus) > PCIBus *pci_register_root_bus(DeviceState *parent, const char *name, > pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, > void *irq_opaque, > - MemoryRegion *address_space_mem, > - MemoryRegion *address_space_io, > + MemoryRegion *mem, MemoryRegion *io, > uint8_t devfn_min, int nirq, > const char *typename) > { > PCIBus *bus; > > - bus = pci_root_bus_new(parent, name, address_space_mem, > - address_space_io, devfn_min, typename); > + bus = pci_root_bus_new(parent, name, mem, io, devfn_min, typename); > pci_bus_irqs(bus, set_irq, irq_opaque, nirq); > pci_bus_map_irqs(bus, map_irq); > return bus; > -- > 2.41.0
