powerpc/pci: Clean up direct access to sysdata by CHRP platforms
authorKumar Gala <galak@kernel.crashing.org>
Thu, 30 Apr 2009 03:10:11 +0000 (03:10 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 21 May 2009 05:44:23 +0000 (15:44 +1000)
We shouldn't directly access sysdata to get the pci_controller.  Instead
use pci_bus_to_host() for this purpose.  In the future we might have
sysdata be a device_node to match ppc64 and unify the code between ppc32
& ppc64.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/chrp/pci.c

index f6b0c51..8f67a39 100644 (file)
@@ -34,7 +34,7 @@ int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off,
                           int len, u32 *val)
 {
        volatile void __iomem *cfg_data;
                           int len, u32 *val)
 {
        volatile void __iomem *cfg_data;
-       struct pci_controller *hose = bus->sysdata;
+       struct pci_controller *hose = pci_bus_to_host(bus);
 
        if (bus->number > 7)
                return PCIBIOS_DEVICE_NOT_FOUND;
 
        if (bus->number > 7)
                return PCIBIOS_DEVICE_NOT_FOUND;
@@ -61,7 +61,7 @@ int gg2_write_config(struct pci_bus *bus, unsigned int devfn, int off,
                            int len, u32 val)
 {
        volatile void __iomem *cfg_data;
                            int len, u32 val)
 {
        volatile void __iomem *cfg_data;
-       struct pci_controller *hose = bus->sysdata;
+       struct pci_controller *hose = pci_bus_to_host(bus);
 
        if (bus->number > 7)
                return PCIBIOS_DEVICE_NOT_FOUND;
 
        if (bus->number > 7)
                return PCIBIOS_DEVICE_NOT_FOUND;
@@ -96,7 +96,7 @@ static struct pci_ops gg2_pci_ops =
 int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
                     int len, u32 *val)
 {
 int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
                     int len, u32 *val)
 {
-       struct pci_controller *hose = bus->sysdata;
+       struct pci_controller *hose = pci_bus_to_host(bus);
        unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
                | (((bus->number - hose->first_busno) & 0xff) << 16)
                | (hose->global_number << 24);
        unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
                | (((bus->number - hose->first_busno) & 0xff) << 16)
                | (hose->global_number << 24);
@@ -111,7 +111,7 @@ int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
 int rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
                      int len, u32 val)
 {
 int rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
                      int len, u32 val)
 {
-       struct pci_controller *hose = bus->sysdata;
+       struct pci_controller *hose = pci_bus_to_host(bus);
        unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
                | (((bus->number - hose->first_busno) & 0xff) << 16)
                | (hose->global_number << 24);
        unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
                | (((bus->number - hose->first_busno) & 0xff) << 16)
                | (hose->global_number << 24);