Message ID | 1416869365-7671-2-git-send-email-gwshan@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
On Tue, 2014-11-25 at 09:49 +1100, Gavin Shan wrote: > The patch moves pcibios_find_pci_bus() to PPC kerenl directory so > that it can be reused by hotplug code for pSeries and PowerNV > platform at the same time. > > Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> > --- > arch/powerpc/kernel/pci-hotplug.c | 36 ++++++++++++++++++++++++++++++ > arch/powerpc/platforms/pseries/pci_dlpar.c | 32 -------------------------- > 2 files changed, 36 insertions(+), 32 deletions(-) > > diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c > index 5b78917..6e2b4e3 100644 > --- a/arch/powerpc/kernel/pci-hotplug.c > +++ b/arch/powerpc/kernel/pci-hotplug.c > @@ -21,6 +21,42 @@ > #include <asm/firmware.h> > #include <asm/eeh.h> > > +static struct pci_bus *find_pci_bus(struct pci_bus *bus, > + struct device_node *dn) > +{ > + struct pci_bus *tmp, *child = NULL; > + struct device_node *busdn; > + > + busdn = pci_bus_to_OF_node(bus); > + if (busdn == dn) > + return bus; > + > + list_for_each_entry(tmp, &bus->children, node) { > + child = find_pci_bus(tmp, dn); > + if (child) > + break; > + } > + > + return child; > +} > + > +/** > + * pcibios_find_pci_bus - find PCI bus according to the given device node > + * @dn: Device node > + * > + * Find the corresponding PCI bus according to the given device node. > + */ > +struct pci_bus *pcibios_find_pci_bus(struct device_node *dn) > +{ > + struct pci_dn *pdn = PCI_DN(dn); > + > + if (!pdn || !pdn->phb || !pdn->phb->bus) > + return NULL; > + > + return find_pci_bus(pdn->phb->bus, dn); > +} > +EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); > + > /** > * pcibios_release_device - release PCI device > * @dev: PCI device > diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c > index 89e2381..98c50bc 100644 > --- a/arch/powerpc/platforms/pseries/pci_dlpar.c > +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c > @@ -32,38 +32,6 @@ > #include <asm/firmware.h> > #include <asm/eeh.h> > > -static struct pci_bus * > -find_bus_among_children(struct pci_bus *bus, > - struct device_node *dn) > -{ > - struct pci_bus *child = NULL; > - struct pci_bus *tmp; > - struct device_node *busdn; > - > - busdn = pci_bus_to_OF_node(bus); > - if (busdn == dn) > - return bus; > - > - list_for_each_entry(tmp, &bus->children, node) { > - child = find_bus_among_children(tmp, dn); > - if (child) > - break; > - }; > - return child; > -} > - > -struct pci_bus * > -pcibios_find_pci_bus(struct device_node *dn) > -{ > - struct pci_dn *pdn = dn->data; > - > - if (!pdn || !pdn->phb || !pdn->phb->bus) > - return NULL; > - > - return find_bus_among_children(pdn->phb->bus, dn); > -} > -EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); > - > struct pci_controller *init_phb_dynamic(struct device_node *dn) > { > struct pci_controller *phb; -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Nov 26, 2014 at 09:58:30AM +1100, Benjamin Herrenschmidt wrote: >On Tue, 2014-11-25 at 09:49 +1100, Gavin Shan wrote: >> The patch moves pcibios_find_pci_bus() to PPC kerenl directory so >> that it can be reused by hotplug code for pSeries and PowerNV >> platform at the same time. >> >> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> > >Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> > Thanks, Ben. But Michael needn't pick it up and merge it as the left patches need reworks to some extent... Thanks, Gavin >> --- >> arch/powerpc/kernel/pci-hotplug.c | 36 ++++++++++++++++++++++++++++++ >> arch/powerpc/platforms/pseries/pci_dlpar.c | 32 -------------------------- >> 2 files changed, 36 insertions(+), 32 deletions(-) >> >> diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c >> index 5b78917..6e2b4e3 100644 >> --- a/arch/powerpc/kernel/pci-hotplug.c >> +++ b/arch/powerpc/kernel/pci-hotplug.c >> @@ -21,6 +21,42 @@ >> #include <asm/firmware.h> >> #include <asm/eeh.h> >> >> +static struct pci_bus *find_pci_bus(struct pci_bus *bus, >> + struct device_node *dn) >> +{ >> + struct pci_bus *tmp, *child = NULL; >> + struct device_node *busdn; >> + >> + busdn = pci_bus_to_OF_node(bus); >> + if (busdn == dn) >> + return bus; >> + >> + list_for_each_entry(tmp, &bus->children, node) { >> + child = find_pci_bus(tmp, dn); >> + if (child) >> + break; >> + } >> + >> + return child; >> +} >> + >> +/** >> + * pcibios_find_pci_bus - find PCI bus according to the given device node >> + * @dn: Device node >> + * >> + * Find the corresponding PCI bus according to the given device node. >> + */ >> +struct pci_bus *pcibios_find_pci_bus(struct device_node *dn) >> +{ >> + struct pci_dn *pdn = PCI_DN(dn); >> + >> + if (!pdn || !pdn->phb || !pdn->phb->bus) >> + return NULL; >> + >> + return find_pci_bus(pdn->phb->bus, dn); >> +} >> +EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); >> + >> /** >> * pcibios_release_device - release PCI device >> * @dev: PCI device >> diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c >> index 89e2381..98c50bc 100644 >> --- a/arch/powerpc/platforms/pseries/pci_dlpar.c >> +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c >> @@ -32,38 +32,6 @@ >> #include <asm/firmware.h> >> #include <asm/eeh.h> >> >> -static struct pci_bus * >> -find_bus_among_children(struct pci_bus *bus, >> - struct device_node *dn) >> -{ >> - struct pci_bus *child = NULL; >> - struct pci_bus *tmp; >> - struct device_node *busdn; >> - >> - busdn = pci_bus_to_OF_node(bus); >> - if (busdn == dn) >> - return bus; >> - >> - list_for_each_entry(tmp, &bus->children, node) { >> - child = find_bus_among_children(tmp, dn); >> - if (child) >> - break; >> - }; >> - return child; >> -} >> - >> -struct pci_bus * >> -pcibios_find_pci_bus(struct device_node *dn) >> -{ >> - struct pci_dn *pdn = dn->data; >> - >> - if (!pdn || !pdn->phb || !pdn->phb->bus) >> - return NULL; >> - >> - return find_bus_among_children(pdn->phb->bus, dn); >> -} >> -EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); >> - >> struct pci_controller *init_phb_dynamic(struct device_node *dn) >> { >> struct pci_controller *phb; > > -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 2014-11-26 at 11:08 +1100, Gavin Shan wrote: > On Wed, Nov 26, 2014 at 09:58:30AM +1100, Benjamin Herrenschmidt wrote: > >On Tue, 2014-11-25 at 09:49 +1100, Gavin Shan wrote: > >> The patch moves pcibios_find_pci_bus() to PPC kerenl directory so > >> that it can be reused by hotplug code for pSeries and PowerNV > >> platform at the same time. > >> > >> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> > > > >Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> > > > > Thanks, Ben. But Michael needn't pick it up and merge it as the left > patches need reworks to some extent... Sure but you can keep that ack around for that specific patch :P) Cheers, Ben. > Thanks, > Gavin > > >> --- > >> arch/powerpc/kernel/pci-hotplug.c | 36 ++++++++++++++++++++++++++++++ > >> arch/powerpc/platforms/pseries/pci_dlpar.c | 32 -------------------------- > >> 2 files changed, 36 insertions(+), 32 deletions(-) > >> > >> diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c > >> index 5b78917..6e2b4e3 100644 > >> --- a/arch/powerpc/kernel/pci-hotplug.c > >> +++ b/arch/powerpc/kernel/pci-hotplug.c > >> @@ -21,6 +21,42 @@ > >> #include <asm/firmware.h> > >> #include <asm/eeh.h> > >> > >> +static struct pci_bus *find_pci_bus(struct pci_bus *bus, > >> + struct device_node *dn) > >> +{ > >> + struct pci_bus *tmp, *child = NULL; > >> + struct device_node *busdn; > >> + > >> + busdn = pci_bus_to_OF_node(bus); > >> + if (busdn == dn) > >> + return bus; > >> + > >> + list_for_each_entry(tmp, &bus->children, node) { > >> + child = find_pci_bus(tmp, dn); > >> + if (child) > >> + break; > >> + } > >> + > >> + return child; > >> +} > >> + > >> +/** > >> + * pcibios_find_pci_bus - find PCI bus according to the given device node > >> + * @dn: Device node > >> + * > >> + * Find the corresponding PCI bus according to the given device node. > >> + */ > >> +struct pci_bus *pcibios_find_pci_bus(struct device_node *dn) > >> +{ > >> + struct pci_dn *pdn = PCI_DN(dn); > >> + > >> + if (!pdn || !pdn->phb || !pdn->phb->bus) > >> + return NULL; > >> + > >> + return find_pci_bus(pdn->phb->bus, dn); > >> +} > >> +EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); > >> + > >> /** > >> * pcibios_release_device - release PCI device > >> * @dev: PCI device > >> diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c > >> index 89e2381..98c50bc 100644 > >> --- a/arch/powerpc/platforms/pseries/pci_dlpar.c > >> +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c > >> @@ -32,38 +32,6 @@ > >> #include <asm/firmware.h> > >> #include <asm/eeh.h> > >> > >> -static struct pci_bus * > >> -find_bus_among_children(struct pci_bus *bus, > >> - struct device_node *dn) > >> -{ > >> - struct pci_bus *child = NULL; > >> - struct pci_bus *tmp; > >> - struct device_node *busdn; > >> - > >> - busdn = pci_bus_to_OF_node(bus); > >> - if (busdn == dn) > >> - return bus; > >> - > >> - list_for_each_entry(tmp, &bus->children, node) { > >> - child = find_bus_among_children(tmp, dn); > >> - if (child) > >> - break; > >> - }; > >> - return child; > >> -} > >> - > >> -struct pci_bus * > >> -pcibios_find_pci_bus(struct device_node *dn) > >> -{ > >> - struct pci_dn *pdn = dn->data; > >> - > >> - if (!pdn || !pdn->phb || !pdn->phb->bus) > >> - return NULL; > >> - > >> - return find_bus_among_children(pdn->phb->bus, dn); > >> -} > >> -EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); > >> - > >> struct pci_controller *init_phb_dynamic(struct device_node *dn) > >> { > >> struct pci_controller *phb; > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c index 5b78917..6e2b4e3 100644 --- a/arch/powerpc/kernel/pci-hotplug.c +++ b/arch/powerpc/kernel/pci-hotplug.c @@ -21,6 +21,42 @@ #include <asm/firmware.h> #include <asm/eeh.h> +static struct pci_bus *find_pci_bus(struct pci_bus *bus, + struct device_node *dn) +{ + struct pci_bus *tmp, *child = NULL; + struct device_node *busdn; + + busdn = pci_bus_to_OF_node(bus); + if (busdn == dn) + return bus; + + list_for_each_entry(tmp, &bus->children, node) { + child = find_pci_bus(tmp, dn); + if (child) + break; + } + + return child; +} + +/** + * pcibios_find_pci_bus - find PCI bus according to the given device node + * @dn: Device node + * + * Find the corresponding PCI bus according to the given device node. + */ +struct pci_bus *pcibios_find_pci_bus(struct device_node *dn) +{ + struct pci_dn *pdn = PCI_DN(dn); + + if (!pdn || !pdn->phb || !pdn->phb->bus) + return NULL; + + return find_pci_bus(pdn->phb->bus, dn); +} +EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); + /** * pcibios_release_device - release PCI device * @dev: PCI device diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c index 89e2381..98c50bc 100644 --- a/arch/powerpc/platforms/pseries/pci_dlpar.c +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c @@ -32,38 +32,6 @@ #include <asm/firmware.h> #include <asm/eeh.h> -static struct pci_bus * -find_bus_among_children(struct pci_bus *bus, - struct device_node *dn) -{ - struct pci_bus *child = NULL; - struct pci_bus *tmp; - struct device_node *busdn; - - busdn = pci_bus_to_OF_node(bus); - if (busdn == dn) - return bus; - - list_for_each_entry(tmp, &bus->children, node) { - child = find_bus_among_children(tmp, dn); - if (child) - break; - }; - return child; -} - -struct pci_bus * -pcibios_find_pci_bus(struct device_node *dn) -{ - struct pci_dn *pdn = dn->data; - - if (!pdn || !pdn->phb || !pdn->phb->bus) - return NULL; - - return find_bus_among_children(pdn->phb->bus, dn); -} -EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); - struct pci_controller *init_phb_dynamic(struct device_node *dn) { struct pci_controller *phb;
The patch moves pcibios_find_pci_bus() to PPC kerenl directory so that it can be reused by hotplug code for pSeries and PowerNV platform at the same time. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> --- arch/powerpc/kernel/pci-hotplug.c | 36 ++++++++++++++++++++++++++++++ arch/powerpc/platforms/pseries/pci_dlpar.c | 32 -------------------------- 2 files changed, 36 insertions(+), 32 deletions(-)