aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/setup-bus.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-01-21 05:08:23 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-02-14 11:44:53 -0500
commit9b03088f955552299f50a1f660372698b07ab339 (patch)
tree4cc4a7d8059186eca4b20a9733f3c0954ff09d96 /drivers/pci/setup-bus.c
parent2f320521a0d2d11fb857be09d05e2fbbf3ef8c13 (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/pci/setup-bus.c')
-rw-r--r--drivers/pci/setup-bus.c39
1 files changed, 39 insertions, 0 deletions
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}
1359EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources); 1359EXPORT_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 */
1371unsigned 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}
1397EXPORT_SYMBOL_GPL(pci_rescan_bus);
1398#endif