Commit 5b21fb8e authored by Kumar Gala's avatar Kumar Gala Committed by Benjamin Herrenschmidt

powerpc/pci: Clean up direct access to sysdata by 52xx platforms

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: default avatarKumar Gala <galak@kernel.crashing.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 8206a110
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
static int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset, static int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
int len, u32 * val) 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) unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
| (((bus->number - hose->first_busno) & 0xff) << 16) | (((bus->number - hose->first_busno) & 0xff) << 16)
| (hose->global_number << 24); | (hose->global_number << 24);
...@@ -49,7 +49,7 @@ static int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset, ...@@ -49,7 +49,7 @@ static int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
static int rtas_write_config(struct pci_bus *bus, unsigned int devfn, static int rtas_write_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 val) 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) unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
| (((bus->number - hose->first_busno) & 0xff) << 16) | (((bus->number - hose->first_busno) & 0xff) << 16)
| (hose->global_number << 24); | (hose->global_number << 24);
......
...@@ -107,7 +107,7 @@ static int ...@@ -107,7 +107,7 @@ static int
mpc52xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, mpc52xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 *val) int offset, int len, u32 *val)
{ {
struct pci_controller *hose = bus->sysdata; struct pci_controller *hose = pci_bus_to_host(bus);
u32 value; u32 value;
if (ppc_md.pci_exclude_device) if (ppc_md.pci_exclude_device)
...@@ -164,7 +164,7 @@ static int ...@@ -164,7 +164,7 @@ static int
mpc52xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, mpc52xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 val) int offset, int len, u32 val)
{ {
struct pci_controller *hose = bus->sysdata; struct pci_controller *hose = pci_bus_to_host(bus);
u32 value, mask; u32 value, mask;
if (ppc_md.pci_exclude_device) if (ppc_md.pci_exclude_device)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment