diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-10-30 16:31:10 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-10-30 16:31:10 -0400 |
commit | 1778794031aae75d4464904319d320edc3e77d39 (patch) | |
tree | b5157865ab7a86f320ec7fc8128b62ddbb7d0a16 /drivers/pci/setup-bus.c | |
parent | 8f0d8163b50e01f398b14bcd4dc039ac5ab18d64 (diff) |
PCI: Separate out pci_assign_unassigned_bus_resources()
It is main portion of pci_rescan_bus().
Separate it out and prepare to use it for PCI root bus hot add later.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/setup-bus.c')
-rw-r--r-- | drivers/pci/setup-bus.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 1e808ca338f8..f64c071d6923 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -1550,25 +1550,12 @@ enable_all: | |||
1550 | } | 1550 | } |
1551 | EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources); | 1551 | EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources); |
1552 | 1552 | ||
1553 | #ifdef CONFIG_HOTPLUG | 1553 | void pci_assign_unassigned_bus_resources(struct pci_bus *bus) |
1554 | /** | ||
1555 | * pci_rescan_bus - scan a PCI bus for devices. | ||
1556 | * @bus: PCI bus to scan | ||
1557 | * | ||
1558 | * Scan a PCI bus and child buses for new devices, adds them, | ||
1559 | * and enables them. | ||
1560 | * | ||
1561 | * Returns the max number of subordinate bus discovered. | ||
1562 | */ | ||
1563 | unsigned int __ref pci_rescan_bus(struct pci_bus *bus) | ||
1564 | { | 1554 | { |
1565 | unsigned int max; | ||
1566 | struct pci_dev *dev; | 1555 | struct pci_dev *dev; |
1567 | LIST_HEAD(add_list); /* list of resources that | 1556 | LIST_HEAD(add_list); /* list of resources that |
1568 | want additional resources */ | 1557 | want additional resources */ |
1569 | 1558 | ||
1570 | max = pci_scan_child_bus(bus); | ||
1571 | |||
1572 | down_read(&pci_bus_sem); | 1559 | down_read(&pci_bus_sem); |
1573 | list_for_each_entry(dev, &bus->devices, bus_list) | 1560 | list_for_each_entry(dev, &bus->devices, bus_list) |
1574 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | 1561 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || |
@@ -1581,6 +1568,24 @@ unsigned int __ref pci_rescan_bus(struct pci_bus *bus) | |||
1581 | BUG_ON(!list_empty(&add_list)); | 1568 | BUG_ON(!list_empty(&add_list)); |
1582 | 1569 | ||
1583 | pci_enable_bridges(bus); | 1570 | pci_enable_bridges(bus); |
1571 | } | ||
1572 | |||
1573 | #ifdef CONFIG_HOTPLUG | ||
1574 | /** | ||
1575 | * pci_rescan_bus - scan a PCI bus for devices. | ||
1576 | * @bus: PCI bus to scan | ||
1577 | * | ||
1578 | * Scan a PCI bus and child buses for new devices, adds them, | ||
1579 | * and enables them. | ||
1580 | * | ||
1581 | * Returns the max number of subordinate bus discovered. | ||
1582 | */ | ||
1583 | unsigned int __ref pci_rescan_bus(struct pci_bus *bus) | ||
1584 | { | ||
1585 | unsigned int max; | ||
1586 | |||
1587 | max = pci_scan_child_bus(bus); | ||
1588 | pci_assign_unassigned_bus_resources(bus); | ||
1584 | pci_bus_add_devices(bus); | 1589 | pci_bus_add_devices(bus); |
1585 | 1590 | ||
1586 | return max; | 1591 | return max; |