aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2016-05-03 01:41:39 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-05-11 07:54:24 -0400
commit6384d97780c123d2e167242862ed4ea9051210e4 (patch)
tree63c873c2e959aa2e63eeef7d93c752662c12ec34 /arch/powerpc/kernel
parent3773dd258e91e1e14d95cdf17b9d83a1a7b27af1 (diff)
powerpc/pci: Move pci_find_bus_by_node() around
This moves pci_find_bus_by_node() from arch/powerpc/platforms/ pseries/pci_dlpar.c to arch/powerpc/kernel/pci-hotplug.c so that the function can be used by pSeries and PowerNV platform at the same time. Also, below cleanup applied. No functional changes introduced. * Remove variable "busdn" in find_bus_among_children() * Use PCI_DN() to convert device node to pci_dn Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/pci-hotplug.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c
index 2d108e541819..46587a14dd94 100644
--- a/arch/powerpc/kernel/pci-hotplug.c
+++ b/arch/powerpc/kernel/pci-hotplug.c
@@ -21,6 +21,35 @@
21#include <asm/firmware.h> 21#include <asm/firmware.h>
22#include <asm/eeh.h> 22#include <asm/eeh.h>
23 23
24static struct pci_bus *find_bus_among_children(struct pci_bus *bus,
25 struct device_node *dn)
26{
27 struct pci_bus *child = NULL;
28 struct pci_bus *tmp;
29
30 if (pci_bus_to_OF_node(bus) == dn)
31 return bus;
32
33 list_for_each_entry(tmp, &bus->children, node) {
34 child = find_bus_among_children(tmp, dn);
35 if (child)
36 break;
37 }
38
39 return child;
40}
41
42struct pci_bus *pci_find_bus_by_node(struct device_node *dn)
43{
44 struct pci_dn *pdn = PCI_DN(dn);
45
46 if (!pdn || !pdn->phb || !pdn->phb->bus)
47 return NULL;
48
49 return find_bus_among_children(pdn->phb->bus, dn);
50}
51EXPORT_SYMBOL_GPL(pci_find_bus_by_node);
52
24/** 53/**
25 * pcibios_release_device - release PCI device 54 * pcibios_release_device - release PCI device
26 * @dev: PCI device 55 * @dev: PCI device