Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / drivers / pci / hotplug-pci.c
blob6258dc260d9f54ac4423998e8b338d4333768ef7
1 /* Core PCI functionality used only by PCI hotplug */
3 #include <linux/pci.h>
4 #include <linux/export.h>
5 #include "pci.h"
7 int __ref pci_hp_add_bridge(struct pci_dev *dev)
9 struct pci_bus *parent = dev->bus;
10 int pass, busnr, start = parent->busn_res.start;
11 int end = parent->busn_res.end;
13 for (busnr = start; busnr <= end; busnr++) {
14 if (!pci_find_bus(pci_domain_nr(parent), busnr))
15 break;
17 if (busnr-- > end) {
18 printk(KERN_ERR "No bus number available for hot-added bridge %s\n",
19 pci_name(dev));
20 return -1;
22 for (pass = 0; pass < 2; pass++)
23 busnr = pci_scan_bridge(parent, dev, busnr, pass);
24 if (!dev->subordinate)
25 return -1;
27 return 0;
29 EXPORT_SYMBOL_GPL(pci_hp_add_bridge);