Skip to content

Commit

Permalink
PCI: Only call pci_stop_bus_device() one time for child devices at re…
Browse files Browse the repository at this point in the history
…move

During debugging pcie hotplug with SRIOV with pcie switch, I found
pci_stop_bus_device() is called several times for some child devices.

So change original pci_remove_bus_device() to __pci_remove_bus_device(),
and make it only do remove work, and add a new pci_remove_bus_device
that calls pci_stop_bus_device() one time, and then call
__pci_remove_bus_device().

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
  • Loading branch information
Yinghai Lu authored and Jesse Barnes committed Jan 6, 2012
1 parent ca3671a commit 79cc960
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/pci/remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ EXPORT_SYMBOL(pci_remove_bus);
* device lists, remove the /proc entry, and notify userspace
* (/sbin/hotplug).
*/
void pci_remove_bus_device(struct pci_dev *dev)
static void __pci_remove_bus_device(struct pci_dev *dev)
{
pci_stop_bus_device(dev);
if (dev->subordinate) {
struct pci_bus *b = dev->subordinate;

Expand All @@ -102,6 +101,11 @@ void pci_remove_bus_device(struct pci_dev *dev)

pci_destroy_dev(dev);
}
void pci_remove_bus_device(struct pci_dev *dev)
{
pci_stop_bus_device(dev);
__pci_remove_bus_device(dev);
}

/**
* pci_remove_behind_bridge - remove all devices behind a PCI bridge
Expand All @@ -117,7 +121,7 @@ void pci_remove_behind_bridge(struct pci_dev *dev)

if (dev->subordinate)
list_for_each_safe(l, n, &dev->subordinate->devices)
pci_remove_bus_device(pci_dev_b(l));
__pci_remove_bus_device(pci_dev_b(l));
}

static void pci_stop_bus_devices(struct pci_bus *bus)
Expand Down

0 comments on commit 79cc960

Please sign in to comment.