[PATCH 15/42] hw/isa/piix3: Prefer pci_address_space() over get_system_memory()

Bernhard Beschow posted 42 patches 3 years, 5 months ago
Maintainers: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <ani@anisinha.ca>, "Hervé Poussineau" <hpoussin@reactos.org>, Aurelien Jarno <aurelien@aurel32.net>
There is a newer version of this series
[PATCH 15/42] hw/isa/piix3: Prefer pci_address_space() over get_system_memory()
Posted by Bernhard Beschow 3 years, 5 months ago
get_system_memory() accesses global state while pci_address_space() uses
whatever has been passed to the device instance, so avoid the global.
Moreover, PIIX4 uses pci_address_space() here as well.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/isa/piix3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c
index 0350f70706..f8fcd47e24 100644
--- a/hw/isa/piix3.c
+++ b/hw/isa/piix3.c
@@ -302,7 +302,7 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp)
     PCIBus *pci_bus = pci_get_bus(dev);
     ISABus *isa_bus;
 
-    isa_bus = isa_bus_new(DEVICE(d), get_system_memory(),
+    isa_bus = isa_bus_new(DEVICE(d), pci_address_space(dev),
                           pci_address_space_io(dev), errp);
     if (!isa_bus) {
         return;
-- 
2.37.3
Re: [PATCH 15/42] hw/isa/piix3: Prefer pci_address_space() over get_system_memory()
Posted by Philippe Mathieu-Daudé via 3 years, 5 months ago
On 1/9/22 18:25, Bernhard Beschow wrote:
> get_system_memory() accesses global state while pci_address_space() uses
> whatever has been passed to the device instance, so avoid the global.
> Moreover, PIIX4 uses pci_address_space() here as well.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/isa/piix3.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>