Skip to content

Commit 95e3ba9

Browse files
westeribjorn-helgaas
authored andcommitted
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>
1 parent 24a0c65 commit 95e3ba9

File tree

3 files changed

+23
-32
lines changed

3 files changed

+23
-32
lines changed

drivers/pci/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ obj-$(CONFIG_PCIEPORTBUS) += pcie/
1616

1717
# Build the PCI Hotplug drivers if we were asked to
1818
obj-$(CONFIG_HOTPLUG_PCI) += hotplug/
19-
ifdef CONFIG_HOTPLUG_PCI
20-
obj-y += hotplug-pci.o
21-
endif
2219

2320
# Build the PCI MSI interrupt support
2421
obj-$(CONFIG_PCI_MSI) += msi.o

drivers/pci/hotplug-pci.c

Lines changed: 0 additions & 29 deletions
This file was deleted.

drivers/pci/probe.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,3 +2735,26 @@ void __init pci_sort_breadthfirst(void)
27352735
{
27362736
bus_sort_breadthfirst(&pci_bus_type, &pci_sort_bf_cmp);
27372737
}
2738+
2739+
int pci_hp_add_bridge(struct pci_dev *dev)
2740+
{
2741+
struct pci_bus *parent = dev->bus;
2742+
int pass, busnr, start = parent->busn_res.start;
2743+
int end = parent->busn_res.end;
2744+
2745+
for (busnr = start; busnr <= end; busnr++) {
2746+
if (!pci_find_bus(pci_domain_nr(parent), busnr))
2747+
break;
2748+
}
2749+
if (busnr-- > end) {
2750+
dev_err(&dev->dev, "No bus number available for hot-added bridge\n");
2751+
return -1;
2752+
}
2753+
for (pass = 0; pass < 2; pass++)
2754+
busnr = pci_scan_bridge(parent, dev, busnr, pass);
2755+
if (!dev->subordinate)
2756+
return -1;
2757+
2758+
return 0;
2759+
}
2760+
EXPORT_SYMBOL_GPL(pci_hp_add_bridge);

0 commit comments

Comments
 (0)