Re: [PATCH 10/12] PCI, pciehp: Separate pci_hp_add_bridge()
From: Bjorn Helgaas
Date: Thu Mar 15 2012 - 17:42:37 EST
On Tue, Mar 13, 2012 at 1:26 AM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote:
> Will use it for other pci hp hotplug support
>
> Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
> ---
> drivers/pci/hotplug-pci.c | 13 +++++++++++++
> drivers/pci/hotplug/pciehp_pci.c | 18 ++----------------
> drivers/pci/pci.h | 1 +
> 3 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/pci/hotplug-pci.c b/drivers/pci/hotplug-pci.c
> index d3509cd..d0999b1 100644
> --- a/drivers/pci/hotplug-pci.c
> +++ b/drivers/pci/hotplug-pci.c
> @@ -4,6 +4,19 @@
> #include <linux/export.h>
> #include "pci.h"
>
> +int __ref pci_hp_add_bridge(struct pci_dev *dev)
> +{
> + struct pci_bus *parent = dev->bus;
> + int pass, busnr = parent->secondary;
> +
> + for (pass = 0; pass < 2; pass++)
> + busnr = pci_scan_bridge(parent, dev, busnr, pass);
> + if (!dev->subordinate)
> + return -1;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(pci_hp_add_bridge);
I'm not sure this is baked enough to use EXPORT_SYMBOL() rather than
EXPORT_SYMBOL_GPL(). For example, maybe we can use the same "add
bridge" interface we normally use, rather than inventing a new
hotplug-specific one. Using EXPORT_SYMBOL() would force us to keep
this interface longer than we might want to.
> unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
> {
> diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c
> index e21171c..b9a9fce 100644
> --- a/drivers/pci/hotplug/pciehp_pci.c
> +++ b/drivers/pci/hotplug/pciehp_pci.c
> @@ -34,19 +34,6 @@
> #include "../pci.h"
> #include "pciehp.h"
>
> -static int __ref pciehp_add_bridge(struct pci_dev *dev)
> -{
> - struct pci_bus *parent = dev->bus;
> - int pass, busnr = parent->secondary;
> -
> - for (pass = 0; pass < 2; pass++)
> - busnr = pci_scan_bridge(parent, dev, busnr, pass);
> - if (!dev->subordinate)
> - return -1;
> -
> - return 0;
> -}
> -
> int pciehp_configure_device(struct slot *p_slot)
> {
> struct pci_dev *dev;
> @@ -75,9 +62,8 @@ int pciehp_configure_device(struct slot *p_slot)
> if (!dev)
> continue;
> if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) ||
> - (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) {
> - pciehp_add_bridge(dev);
> - }
> + (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS))
> + pci_hp_add_bridge(dev);
> pci_dev_put(dev);
> }
>
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 13b1159..9378d81 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -124,6 +124,7 @@ static inline int pci_proc_detach_bus(struct pci_bus *bus) { return 0; }
> #endif
>
> /* Functions for PCI Hotplug drivers to use */
> +int pci_hp_add_bridge(struct pci_dev *dev);
> extern unsigned int pci_do_scan_bus(struct pci_bus *bus);
>
> #ifdef HAVE_PCI_LEGACY
> --
> 1.7.7
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/