diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2017-10-13 21:35:41 +0300 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-11-06 18:48:58 -0600 |
commit | 95e3ba9772331502cc33f1e1d4a96f3310e2f31e (patch) | |
tree | bef843c0160f1651a68b46e062cdb9c1dc400b52 /drivers/pci/probe.c | |
parent | 24a0c654d7d6063301c51361f911369264342b3c (diff) |
PCI: Move pci_hp_add_bridge() to drivers/pci/probe.c
There is not much point of having a file with a single function in it.
Instead we can just move pci_hp_add_bridge() to drivers/pci/probe.c and
make it available always when PCI core is enabled.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
[bhelgaas: convert printk to dev_err()]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index cdc2f83c11c5..62d45a76f663 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2735,3 +2735,26 @@ void __init pci_sort_breadthfirst(void) { bus_sort_breadthfirst(&pci_bus_type, &pci_sort_bf_cmp); } + +int pci_hp_add_bridge(struct pci_dev *dev) +{ + struct pci_bus *parent = dev->bus; + int pass, busnr, start = parent->busn_res.start; + int end = parent->busn_res.end; + + for (busnr = start; busnr <= end; busnr++) { + if (!pci_find_bus(pci_domain_nr(parent), busnr)) + break; + } + if (busnr-- > end) { + dev_err(&dev->dev, "No bus number available for hot-added bridge\n"); + return -1; + } + for (pass = 0; pass < 2; pass++) + busnr = pci_scan_bridge(parent, dev, busnr, pass); + if (!dev->subordinate) + return -1; + + return 0; +} +EXPORT_SYMBOL_GPL(pci_hp_add_bridge); |