diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2009-04-29 23:10:15 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-05-21 01:44:24 -0400 |
commit | 58513dc40d8e01f0c0ccea4cdcbc32e9dcee62fd (patch) | |
tree | 585debc810954d0cac80619c85d5a5ab50ceda41 /arch/powerpc | |
parent | 2f52297665d2ebfaa24406003cf9e5a7b635f47d (diff) |
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: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/cell/celleb_pci.c | 10 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/celleb_scc_epci.c | 13 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/celleb_scc_pciex.c | 12 |
3 files changed, 6 insertions, 29 deletions
diff --git a/arch/powerpc/platforms/cell/celleb_pci.c b/arch/powerpc/platforms/cell/celleb_pci.c index f39a3b2a1667..00eaaa71630f 100644 --- a/arch/powerpc/platforms/cell/celleb_pci.c +++ b/arch/powerpc/platforms/cell/celleb_pci.c | |||
@@ -162,8 +162,7 @@ static int celleb_fake_pci_read_config(struct pci_bus *bus, | |||
162 | unsigned int devfn, int where, int size, u32 *val) | 162 | unsigned int devfn, int where, int size, u32 *val) |
163 | { | 163 | { |
164 | char *config; | 164 | char *config; |
165 | struct device_node *node; | 165 | struct pci_controller *hose = pci_bus_to_host(bus); |
166 | struct pci_controller *hose; | ||
167 | unsigned int devno = devfn >> 3; | 166 | unsigned int devno = devfn >> 3; |
168 | unsigned int fn = devfn & 0x7; | 167 | unsigned int fn = devfn & 0x7; |
169 | 168 | ||
@@ -171,8 +170,6 @@ static int celleb_fake_pci_read_config(struct pci_bus *bus, | |||
171 | BUG_ON(where % size); | 170 | BUG_ON(where % size); |
172 | 171 | ||
173 | pr_debug(" fake read: bus=0x%x, ", bus->number); | 172 | pr_debug(" fake read: bus=0x%x, ", bus->number); |
174 | node = (struct device_node *)bus->sysdata; | ||
175 | hose = pci_find_hose_for_OF_device(node); | ||
176 | config = get_fake_config_start(hose, devno, fn); | 173 | config = get_fake_config_start(hose, devno, fn); |
177 | 174 | ||
178 | pr_debug("devno=0x%x, where=0x%x, size=0x%x, ", devno, where, size); | 175 | 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 | unsigned int devfn, int where, int size, u32 val) | 189 | unsigned int devfn, int where, int size, u32 val) |
193 | { | 190 | { |
194 | char *config; | 191 | char *config; |
195 | struct device_node *node; | 192 | struct pci_controller *hose = pci_bus_to_host(bus); |
196 | struct pci_controller *hose; | ||
197 | struct celleb_pci_resource *res; | 193 | struct celleb_pci_resource *res; |
198 | unsigned int devno = devfn >> 3; | 194 | unsigned int devno = devfn >> 3; |
199 | unsigned int fn = devfn & 0x7; | 195 | unsigned int fn = devfn & 0x7; |
@@ -201,8 +197,6 @@ static int celleb_fake_pci_write_config(struct pci_bus *bus, | |||
201 | /* allignment check */ | 197 | /* allignment check */ |
202 | BUG_ON(where % size); | 198 | BUG_ON(where % size); |
203 | 199 | ||
204 | node = (struct device_node *)bus->sysdata; | ||
205 | hose = pci_find_hose_for_OF_device(node); | ||
206 | config = get_fake_config_start(hose, devno, fn); | 200 | config = get_fake_config_start(hose, devno, fn); |
207 | 201 | ||
208 | if (!config) | 202 | if (!config) |
diff --git a/arch/powerpc/platforms/cell/celleb_scc_epci.c b/arch/powerpc/platforms/cell/celleb_scc_epci.c index 48ec88a38a12..05b0db3ef638 100644 --- a/arch/powerpc/platforms/cell/celleb_scc_epci.c +++ b/arch/powerpc/platforms/cell/celleb_scc_epci.c | |||
@@ -134,15 +134,11 @@ static int celleb_epci_read_config(struct pci_bus *bus, | |||
134 | { | 134 | { |
135 | PCI_IO_ADDR epci_base; | 135 | PCI_IO_ADDR epci_base; |
136 | PCI_IO_ADDR addr; | 136 | PCI_IO_ADDR addr; |
137 | struct device_node *node; | 137 | struct pci_controller *hose = pci_bus_to_host(bus); |
138 | struct pci_controller *hose; | ||
139 | 138 | ||
140 | /* allignment check */ | 139 | /* allignment check */ |
141 | BUG_ON(where % size); | 140 | BUG_ON(where % size); |
142 | 141 | ||
143 | node = (struct device_node *)bus->sysdata; | ||
144 | hose = pci_find_hose_for_OF_device(node); | ||
145 | |||
146 | if (!celleb_epci_get_epci_cfg(hose)) | 142 | if (!celleb_epci_get_epci_cfg(hose)) |
147 | return PCIBIOS_DEVICE_NOT_FOUND; | 143 | return PCIBIOS_DEVICE_NOT_FOUND; |
148 | 144 | ||
@@ -198,16 +194,11 @@ static int celleb_epci_write_config(struct pci_bus *bus, | |||
198 | { | 194 | { |
199 | PCI_IO_ADDR epci_base; | 195 | PCI_IO_ADDR epci_base; |
200 | PCI_IO_ADDR addr; | 196 | PCI_IO_ADDR addr; |
201 | struct device_node *node; | 197 | struct pci_controller *hose = pci_bus_to_host(bus); |
202 | struct pci_controller *hose; | ||
203 | 198 | ||
204 | /* allignment check */ | 199 | /* allignment check */ |
205 | BUG_ON(where % size); | 200 | BUG_ON(where % size); |
206 | 201 | ||
207 | node = (struct device_node *)bus->sysdata; | ||
208 | hose = pci_find_hose_for_OF_device(node); | ||
209 | |||
210 | |||
211 | if (!celleb_epci_get_epci_cfg(hose)) | 202 | if (!celleb_epci_get_epci_cfg(hose)) |
212 | return PCIBIOS_DEVICE_NOT_FOUND; | 203 | return PCIBIOS_DEVICE_NOT_FOUND; |
213 | 204 | ||
diff --git a/arch/powerpc/platforms/cell/celleb_scc_pciex.c b/arch/powerpc/platforms/cell/celleb_scc_pciex.c index 3e7e0f1568ef..7fca09f990ba 100644 --- a/arch/powerpc/platforms/cell/celleb_scc_pciex.c +++ b/arch/powerpc/platforms/cell/celleb_scc_pciex.c | |||
@@ -366,11 +366,7 @@ static void config_write_pciex_rc(unsigned int __iomem *base, uint32_t where, | |||
366 | static int scc_pciex_read_config(struct pci_bus *bus, unsigned int devfn, | 366 | static int scc_pciex_read_config(struct pci_bus *bus, unsigned int devfn, |
367 | int where, int size, unsigned int *val) | 367 | int where, int size, unsigned int *val) |
368 | { | 368 | { |
369 | struct device_node *dn; | 369 | struct pci_controller *phb = pci_bus_to_host(bus); |
370 | struct pci_controller *phb; | ||
371 | |||
372 | dn = bus->sysdata; | ||
373 | phb = pci_find_hose_for_OF_device(dn); | ||
374 | 370 | ||
375 | if (bus->number == phb->first_busno && PCI_SLOT(devfn) != 1) { | 371 | if (bus->number == phb->first_busno && PCI_SLOT(devfn) != 1) { |
376 | *val = ~0; | 372 | *val = ~0; |
@@ -389,11 +385,7 @@ static int scc_pciex_read_config(struct pci_bus *bus, unsigned int devfn, | |||
389 | static int scc_pciex_write_config(struct pci_bus *bus, unsigned int devfn, | 385 | static int scc_pciex_write_config(struct pci_bus *bus, unsigned int devfn, |
390 | int where, int size, unsigned int val) | 386 | int where, int size, unsigned int val) |
391 | { | 387 | { |
392 | struct device_node *dn; | 388 | struct pci_controller *phb = pci_bus_to_host(bus); |
393 | struct pci_controller *phb; | ||
394 | |||
395 | dn = bus->sysdata; | ||
396 | phb = pci_find_hose_for_OF_device(dn); | ||
397 | 389 | ||
398 | if (bus->number == phb->first_busno && PCI_SLOT(devfn) != 1) | 390 | if (bus->number == phb->first_busno && PCI_SLOT(devfn) != 1) |
399 | return PCIBIOS_DEVICE_NOT_FOUND; | 391 | return PCIBIOS_DEVICE_NOT_FOUND; |