diff options
-rw-r--r-- | drivers/pci/pci-sysfs.c | 5 | ||||
-rw-r--r-- | drivers/pci/probe.c | 25 | ||||
-rw-r--r-- | include/linux/pci.h | 1 |
3 files changed, 30 insertions, 1 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index a3cd8cad532a..d9723039e99a 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -366,7 +366,10 @@ dev_bus_rescan_store(struct device *dev, struct device_attribute *attr, | |||
366 | 366 | ||
367 | if (val) { | 367 | if (val) { |
368 | mutex_lock(&pci_remove_rescan_mutex); | 368 | mutex_lock(&pci_remove_rescan_mutex); |
369 | pci_rescan_bus(bus); | 369 | if (!pci_is_root_bus(bus) && list_empty(&bus->devices)) |
370 | pci_rescan_bus_bridge_resize(bus->self); | ||
371 | else | ||
372 | pci_rescan_bus(bus); | ||
370 | mutex_unlock(&pci_remove_rescan_mutex); | 373 | mutex_unlock(&pci_remove_rescan_mutex); |
371 | } | 374 | } |
372 | return count; | 375 | return count; |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 71eac9cd724d..0e84e8c2a6d0 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -1667,6 +1667,31 @@ EXPORT_SYMBOL(pci_scan_bus); | |||
1667 | 1667 | ||
1668 | #ifdef CONFIG_HOTPLUG | 1668 | #ifdef CONFIG_HOTPLUG |
1669 | /** | 1669 | /** |
1670 | * pci_rescan_bus_bridge_resize - scan a PCI bus for devices. | ||
1671 | * @bridge: PCI bridge for the bus to scan | ||
1672 | * | ||
1673 | * Scan a PCI bus and child buses for new devices, add them, | ||
1674 | * and enable them, resizing bridge mmio/io resource if necessary | ||
1675 | * and possible. The caller must ensure the child devices are already | ||
1676 | * removed for resizing to occur. | ||
1677 | * | ||
1678 | * Returns the max number of subordinate bus discovered. | ||
1679 | */ | ||
1680 | unsigned int __ref pci_rescan_bus_bridge_resize(struct pci_dev *bridge) | ||
1681 | { | ||
1682 | unsigned int max; | ||
1683 | struct pci_bus *bus = bridge->subordinate; | ||
1684 | |||
1685 | max = pci_scan_child_bus(bus); | ||
1686 | |||
1687 | pci_assign_unassigned_bridge_resources(bridge); | ||
1688 | |||
1689 | pci_bus_add_devices(bus); | ||
1690 | |||
1691 | return max; | ||
1692 | } | ||
1693 | |||
1694 | /** | ||
1670 | * pci_rescan_bus - scan a PCI bus for devices. | 1695 | * pci_rescan_bus - scan a PCI bus for devices. |
1671 | * @bus: PCI bus to scan | 1696 | * @bus: PCI bus to scan |
1672 | * | 1697 | * |
diff --git a/include/linux/pci.h b/include/linux/pci.h index f44276049f4a..87507aadf9a2 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -882,6 +882,7 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev); | |||
882 | /* Functions for PCI Hotplug drivers to use */ | 882 | /* Functions for PCI Hotplug drivers to use */ |
883 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); | 883 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); |
884 | #ifdef CONFIG_HOTPLUG | 884 | #ifdef CONFIG_HOTPLUG |
885 | unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge); | ||
885 | unsigned int pci_rescan_bus(struct pci_bus *bus); | 886 | unsigned int pci_rescan_bus(struct pci_bus *bus); |
886 | #endif | 887 | #endif |
887 | 888 | ||