提交 58513dc4 编写于 作者: K Kumar Gala 提交者: Benjamin Herrenschmidt

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

We shouldn't directly access sysdata to get the device node to just
go get the pci_controller.  We can call pci_bus_to_host() for this
purpose.
Signed-off-by: NKumar Gala <galak@kernel.crashing.org>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 2f522976
...@@ -162,8 +162,7 @@ static int celleb_fake_pci_read_config(struct pci_bus *bus, ...@@ -162,8 +162,7 @@ static int celleb_fake_pci_read_config(struct pci_bus *bus,
unsigned int devfn, int where, int size, u32 *val) unsigned int devfn, int where, int size, u32 *val)
{ {
char *config; char *config;
struct device_node *node; struct pci_controller *hose = pci_bus_to_host(bus);
struct pci_controller *hose;
unsigned int devno = devfn >> 3; unsigned int devno = devfn >> 3;
unsigned int fn = devfn & 0x7; unsigned int fn = devfn & 0x7;
...@@ -171,8 +170,6 @@ static int celleb_fake_pci_read_config(struct pci_bus *bus, ...@@ -171,8 +170,6 @@ static int celleb_fake_pci_read_config(struct pci_bus *bus,
BUG_ON(where % size); BUG_ON(where % size);
pr_debug(" fake read: bus=0x%x, ", bus->number); pr_debug(" fake read: bus=0x%x, ", bus->number);
node = (struct device_node *)bus->sysdata;
hose = pci_find_hose_for_OF_device(node);
config = get_fake_config_start(hose, devno, fn); config = get_fake_config_start(hose, devno, fn);
pr_debug("devno=0x%x, where=0x%x, size=0x%x, ", devno, where, size); pr_debug("devno=0x%x, where=0x%x, size=0x%x, ", devno, where, size);
...@@ -192,8 +189,7 @@ static int celleb_fake_pci_write_config(struct pci_bus *bus, ...@@ -192,8 +189,7 @@ static int celleb_fake_pci_write_config(struct pci_bus *bus,
unsigned int devfn, int where, int size, u32 val) unsigned int devfn, int where, int size, u32 val)
{ {
char *config; char *config;
struct device_node *node; struct pci_controller *hose = pci_bus_to_host(bus);
struct pci_controller *hose;
struct celleb_pci_resource *res; struct celleb_pci_resource *res;
unsigned int devno = devfn >> 3; unsigned int devno = devfn >> 3;
unsigned int fn = devfn & 0x7; unsigned int fn = devfn & 0x7;
...@@ -201,8 +197,6 @@ static int celleb_fake_pci_write_config(struct pci_bus *bus, ...@@ -201,8 +197,6 @@ static int celleb_fake_pci_write_config(struct pci_bus *bus,
/* allignment check */ /* allignment check */
BUG_ON(where % size); BUG_ON(where % size);
node = (struct device_node *)bus->sysdata;
hose = pci_find_hose_for_OF_device(node);
config = get_fake_config_start(hose, devno, fn); config = get_fake_config_start(hose, devno, fn);
if (!config) if (!config)
......
...@@ -134,15 +134,11 @@ static int celleb_epci_read_config(struct pci_bus *bus, ...@@ -134,15 +134,11 @@ static int celleb_epci_read_config(struct pci_bus *bus,
{ {
PCI_IO_ADDR epci_base; PCI_IO_ADDR epci_base;
PCI_IO_ADDR addr; PCI_IO_ADDR addr;
struct device_node *node; struct pci_controller *hose = pci_bus_to_host(bus);
struct pci_controller *hose;
/* allignment check */ /* allignment check */
BUG_ON(where % size); BUG_ON(where % size);
node = (struct device_node *)bus->sysdata;
hose = pci_find_hose_for_OF_device(node);
if (!celleb_epci_get_epci_cfg(hose)) if (!celleb_epci_get_epci_cfg(hose))
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
...@@ -198,16 +194,11 @@ static int celleb_epci_write_config(struct pci_bus *bus, ...@@ -198,16 +194,11 @@ static int celleb_epci_write_config(struct pci_bus *bus,
{ {
PCI_IO_ADDR epci_base; PCI_IO_ADDR epci_base;
PCI_IO_ADDR addr; PCI_IO_ADDR addr;
struct device_node *node; struct pci_controller *hose = pci_bus_to_host(bus);
struct pci_controller *hose;
/* allignment check */ /* allignment check */
BUG_ON(where % size); BUG_ON(where % size);
node = (struct device_node *)bus->sysdata;
hose = pci_find_hose_for_OF_device(node);
if (!celleb_epci_get_epci_cfg(hose)) if (!celleb_epci_get_epci_cfg(hose))
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
......
...@@ -366,11 +366,7 @@ static void config_write_pciex_rc(unsigned int __iomem *base, uint32_t where, ...@@ -366,11 +366,7 @@ static void config_write_pciex_rc(unsigned int __iomem *base, uint32_t where,
static int scc_pciex_read_config(struct pci_bus *bus, unsigned int devfn, static int scc_pciex_read_config(struct pci_bus *bus, unsigned int devfn,
int where, int size, unsigned int *val) int where, int size, unsigned int *val)
{ {
struct device_node *dn; struct pci_controller *phb = pci_bus_to_host(bus);
struct pci_controller *phb;
dn = bus->sysdata;
phb = pci_find_hose_for_OF_device(dn);
if (bus->number == phb->first_busno && PCI_SLOT(devfn) != 1) { if (bus->number == phb->first_busno && PCI_SLOT(devfn) != 1) {
*val = ~0; *val = ~0;
...@@ -389,11 +385,7 @@ static int scc_pciex_read_config(struct pci_bus *bus, unsigned int devfn, ...@@ -389,11 +385,7 @@ static int scc_pciex_read_config(struct pci_bus *bus, unsigned int devfn,
static int scc_pciex_write_config(struct pci_bus *bus, unsigned int devfn, static int scc_pciex_write_config(struct pci_bus *bus, unsigned int devfn,
int where, int size, unsigned int val) int where, int size, unsigned int val)
{ {
struct device_node *dn; struct pci_controller *phb = pci_bus_to_host(bus);
struct pci_controller *phb;
dn = bus->sysdata;
phb = pci_find_hose_for_OF_device(dn);
if (bus->number == phb->first_busno && PCI_SLOT(devfn) != 1) if (bus->number == phb->first_busno && PCI_SLOT(devfn) != 1)
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册