diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-01-21 05:08:23 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2012-02-14 11:44:53 -0500 |
commit | 9b03088f955552299f50a1f660372698b07ab339 (patch) | |
tree | 4cc4a7d8059186eca4b20a9733f3c0954ff09d96 /drivers | |
parent | 2f320521a0d2d11fb857be09d05e2fbbf3ef8c13 (diff) |
PCI: Make pci_rescan_bus handle add_list
This allows us to allocate resources to hotplug bridges during
remove/rescan.
We need to move the function to setup-bus.c so it can use
__pci_bus_size_bridges and __pci_bus_assign_resources directly to take
the add_list resource tracking list.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/probe.c | 32 | ||||
-rw-r--r-- | drivers/pci/setup-bus.c | 39 |
2 files changed, 39 insertions, 32 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 0e84e8c2a6d0..aad7d0ff6b08 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -1691,38 +1691,6 @@ unsigned int __ref pci_rescan_bus_bridge_resize(struct pci_dev *bridge) | |||
1691 | return max; | 1691 | return max; |
1692 | } | 1692 | } |
1693 | 1693 | ||
1694 | /** | ||
1695 | * pci_rescan_bus - scan a PCI bus for devices. | ||
1696 | * @bus: PCI bus to scan | ||
1697 | * | ||
1698 | * Scan a PCI bus and child buses for new devices, adds them, | ||
1699 | * and enables them. | ||
1700 | * | ||
1701 | * Returns the max number of subordinate bus discovered. | ||
1702 | */ | ||
1703 | unsigned int __ref pci_rescan_bus(struct pci_bus *bus) | ||
1704 | { | ||
1705 | unsigned int max; | ||
1706 | struct pci_dev *dev; | ||
1707 | |||
1708 | max = pci_scan_child_bus(bus); | ||
1709 | |||
1710 | down_read(&pci_bus_sem); | ||
1711 | list_for_each_entry(dev, &bus->devices, bus_list) | ||
1712 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | ||
1713 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) | ||
1714 | if (dev->subordinate) | ||
1715 | pci_bus_size_bridges(dev->subordinate); | ||
1716 | up_read(&pci_bus_sem); | ||
1717 | |||
1718 | pci_bus_assign_resources(bus); | ||
1719 | pci_enable_bridges(bus); | ||
1720 | pci_bus_add_devices(bus); | ||
1721 | |||
1722 | return max; | ||
1723 | } | ||
1724 | EXPORT_SYMBOL_GPL(pci_rescan_bus); | ||
1725 | |||
1726 | EXPORT_SYMBOL(pci_add_new_bus); | 1694 | EXPORT_SYMBOL(pci_add_new_bus); |
1727 | EXPORT_SYMBOL(pci_scan_slot); | 1695 | EXPORT_SYMBOL(pci_scan_slot); |
1728 | EXPORT_SYMBOL(pci_scan_bridge); | 1696 | EXPORT_SYMBOL(pci_scan_bridge); |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 97c1eda96e64..c09c67ab5612 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -1357,3 +1357,42 @@ enable_all: | |||
1357 | pci_enable_bridges(parent); | 1357 | pci_enable_bridges(parent); |
1358 | } | 1358 | } |
1359 | EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources); | 1359 | EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources); |
1360 | |||
1361 | #ifdef CONFIG_HOTPLUG | ||
1362 | /** | ||
1363 | * pci_rescan_bus - scan a PCI bus for devices. | ||
1364 | * @bus: PCI bus to scan | ||
1365 | * | ||
1366 | * Scan a PCI bus and child buses for new devices, adds them, | ||
1367 | * and enables them. | ||
1368 | * | ||
1369 | * Returns the max number of subordinate bus discovered. | ||
1370 | */ | ||
1371 | unsigned int __ref pci_rescan_bus(struct pci_bus *bus) | ||
1372 | { | ||
1373 | unsigned int max; | ||
1374 | struct pci_dev *dev; | ||
1375 | struct resource_list_x add_list; /* list of resources that | ||
1376 | want additional resources */ | ||
1377 | |||
1378 | max = pci_scan_child_bus(bus); | ||
1379 | |||
1380 | add_list.next = NULL; | ||
1381 | down_read(&pci_bus_sem); | ||
1382 | list_for_each_entry(dev, &bus->devices, bus_list) | ||
1383 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | ||
1384 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) | ||
1385 | if (dev->subordinate) | ||
1386 | __pci_bus_size_bridges(dev->subordinate, | ||
1387 | &add_list); | ||
1388 | up_read(&pci_bus_sem); | ||
1389 | __pci_bus_assign_resources(bus, &add_list, NULL); | ||
1390 | BUG_ON(add_list.next); | ||
1391 | |||
1392 | pci_enable_bridges(bus); | ||
1393 | pci_bus_add_devices(bus); | ||
1394 | |||
1395 | return max; | ||
1396 | } | ||
1397 | EXPORT_SYMBOL_GPL(pci_rescan_bus); | ||
1398 | #endif | ||