qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, Eduardo Habkost <eduardo@habkost.net>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	qemu-s390x@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Ani Sinha <anisinha@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Yanan Wang <wangyanan55@huawei.com>,
	David Hildenbrand <david@redhat.com>,
	Eric Farman <farman@linux.ibm.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Markus Armbruster <armbru@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	Thomas Huth <thuth@redhat.com>, Halil Pasic <pasic@linux.ibm.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Ilya Leoshkevich <iii@linux.ibm.com>
Subject: Re: [PATCH 5/6] hw/pci: Clean up global variable shadowing of address_space_io variable
Date: Mon, 9 Oct 2023 12:22:58 -0400	[thread overview]
Message-ID: <20231009122253-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20231009094747.54240-6-philmd@linaro.org>

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é <philmd@linaro.org>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  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



  reply	other threads:[~2023-10-09 16:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09  9:47 [PATCH 0/6] hw: Clean up global variables shadowing Philippe Mathieu-Daudé
2023-10-09  9:47 ` [PATCH 1/6] hw/core/cpu: Clean up global variable shadowing Philippe Mathieu-Daudé
2023-10-09  9:47 ` [PATCH 2/6] hw/loader: Clean up global variable shadowing in rom_add_file() Philippe Mathieu-Daudé
2023-10-09 12:25   ` Ani Sinha
2023-10-09  9:47 ` [PATCH 3/6] hw/display/vga: Clean up global variable shadowing Philippe Mathieu-Daudé
2023-10-09 14:11   ` Ani Sinha
2023-10-09 15:43     ` Philippe Mathieu-Daudé
2023-10-09  9:47 ` [PATCH 4/6] hw/acpi/pcihp: Clean up global variable shadowing in acpi_pcihp_init() Philippe Mathieu-Daudé
2023-10-09 12:04   ` Ani Sinha
2023-10-09 16:22   ` Michael S. Tsirkin
2023-10-09  9:47 ` [PATCH 5/6] hw/pci: Clean up global variable shadowing of address_space_io variable Philippe Mathieu-Daudé
2023-10-09 16:22   ` Michael S. Tsirkin [this message]
2023-10-09  9:47 ` [PATCH 6/6] hw/s390x: Clean up global variable shadowing in quiesce_powerdown_req() Philippe Mathieu-Daudé
2023-10-09  9:51   ` Thomas Huth
2023-10-09  9:52   ` David Hildenbrand
2023-10-11 11:58   ` Eric Farman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231009122253-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=anisinha@redhat.com \
    --cc=armbru@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=farman@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=imammedo@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=wangyanan55@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).