Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Kumar Gala and committed by
Benjamin Herrenschmidt
58513dc4 2f522976

+6 -29
+2 -8
arch/powerpc/platforms/cell/celleb_pci.c
··· 162 162 unsigned int devfn, int where, int size, u32 *val) 163 163 { 164 164 char *config; 165 - struct device_node *node; 166 - struct pci_controller *hose; 165 + struct pci_controller *hose = pci_bus_to_host(bus); 167 166 unsigned int devno = devfn >> 3; 168 167 unsigned int fn = devfn & 0x7; 169 168 ··· 170 171 BUG_ON(where % size); 171 172 172 173 pr_debug(" fake read: bus=0x%x, ", bus->number); 173 - node = (struct device_node *)bus->sysdata; 174 - hose = pci_find_hose_for_OF_device(node); 175 174 config = get_fake_config_start(hose, devno, fn); 176 175 177 176 pr_debug("devno=0x%x, where=0x%x, size=0x%x, ", devno, where, size); ··· 189 192 unsigned int devfn, int where, int size, u32 val) 190 193 { 191 194 char *config; 192 - struct device_node *node; 193 - struct pci_controller *hose; 195 + struct pci_controller *hose = pci_bus_to_host(bus); 194 196 struct celleb_pci_resource *res; 195 197 unsigned int devno = devfn >> 3; 196 198 unsigned int fn = devfn & 0x7; ··· 197 201 /* allignment check */ 198 202 BUG_ON(where % size); 199 203 200 - node = (struct device_node *)bus->sysdata; 201 - hose = pci_find_hose_for_OF_device(node); 202 204 config = get_fake_config_start(hose, devno, fn); 203 205 204 206 if (!config)
+2 -11
arch/powerpc/platforms/cell/celleb_scc_epci.c
··· 134 134 { 135 135 PCI_IO_ADDR epci_base; 136 136 PCI_IO_ADDR addr; 137 - struct device_node *node; 138 - struct pci_controller *hose; 137 + struct pci_controller *hose = pci_bus_to_host(bus); 139 138 140 139 /* allignment check */ 141 140 BUG_ON(where % size); 142 - 143 - node = (struct device_node *)bus->sysdata; 144 - hose = pci_find_hose_for_OF_device(node); 145 141 146 142 if (!celleb_epci_get_epci_cfg(hose)) 147 143 return PCIBIOS_DEVICE_NOT_FOUND; ··· 194 198 { 195 199 PCI_IO_ADDR epci_base; 196 200 PCI_IO_ADDR addr; 197 - struct device_node *node; 198 - struct pci_controller *hose; 201 + struct pci_controller *hose = pci_bus_to_host(bus); 199 202 200 203 /* allignment check */ 201 204 BUG_ON(where % size); 202 - 203 - node = (struct device_node *)bus->sysdata; 204 - hose = pci_find_hose_for_OF_device(node); 205 - 206 205 207 206 if (!celleb_epci_get_epci_cfg(hose)) 208 207 return PCIBIOS_DEVICE_NOT_FOUND;
+2 -10
arch/powerpc/platforms/cell/celleb_scc_pciex.c
··· 366 366 static int scc_pciex_read_config(struct pci_bus *bus, unsigned int devfn, 367 367 int where, int size, unsigned int *val) 368 368 { 369 - struct device_node *dn; 370 - struct pci_controller *phb; 371 - 372 - dn = bus->sysdata; 373 - phb = pci_find_hose_for_OF_device(dn); 369 + struct pci_controller *phb = pci_bus_to_host(bus); 374 370 375 371 if (bus->number == phb->first_busno && PCI_SLOT(devfn) != 1) { 376 372 *val = ~0; ··· 385 389 static int scc_pciex_write_config(struct pci_bus *bus, unsigned int devfn, 386 390 int where, int size, unsigned int val) 387 391 { 388 - struct device_node *dn; 389 - struct pci_controller *phb; 390 - 391 - dn = bus->sysdata; 392 - phb = pci_find_hose_for_OF_device(dn); 392 + struct pci_controller *phb = pci_bus_to_host(bus); 393 393 394 394 if (bus->number == phb->first_busno && PCI_SLOT(devfn) != 1) 395 395 return PCIBIOS_DEVICE_NOT_FOUND;