hotplug-pci.c 702 B

1234567891011121314151617181920212223242526272829
  1. /* Core PCI functionality used only by PCI hotplug */
  2. #include <linux/pci.h>
  3. #include <linux/export.h>
  4. #include "pci.h"
  5. int pci_hp_add_bridge(struct pci_dev *dev)
  6. {
  7. struct pci_bus *parent = dev->bus;
  8. int pass, busnr, start = parent->busn_res.start;
  9. int end = parent->busn_res.end;
  10. for (busnr = start; busnr <= end; busnr++) {
  11. if (!pci_find_bus(pci_domain_nr(parent), busnr))
  12. break;
  13. }
  14. if (busnr-- > end) {
  15. printk(KERN_ERR "No bus number available for hot-added bridge %s\n",
  16. pci_name(dev));
  17. return -1;
  18. }
  19. for (pass = 0; pass < 2; pass++)
  20. busnr = pci_scan_bridge(parent, dev, busnr, pass);
  21. if (!dev->subordinate)
  22. return -1;
  23. return 0;
  24. }
  25. EXPORT_SYMBOL_GPL(pci_hp_add_bridge);