summaryrefslogtreecommitdiff
path: root/drivers/pci/remove.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2012-08-17 15:53:27 -0600
committerBjorn Helgaas <bhelgaas@google.com>2012-08-22 11:31:37 -0600
commit66455f5472383df3632140e04f0852215e5c9ce8 (patch)
tree647bff405ef4cbdd01b1dba594e632b715029e54 /drivers/pci/remove.c
parent125e14bb35e65b1ddfb7252fa8f6e3c50dbb6db2 (diff)
PCI: Use list_for_each_entry() for bus->devices traversal
Replace list_for_each() + pci_dev_b() with the simpler list_for_each_entry(). Tested-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Yinghai Lu <yinghai@kernel.org>
Diffstat (limited to 'drivers/pci/remove.c')
-rw-r--r--drivers/pci/remove.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index b18dc2ef09f2..f17a02781e67 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -114,16 +114,17 @@ void pci_stop_and_remove_bus_device(struct pci_dev *dev)
static void __pci_remove_behind_bridge(struct pci_dev *dev)
{
- struct list_head *l, *n;
+ struct pci_dev *child, *tmp;
if (dev->subordinate)
- list_for_each_safe(l, n, &dev->subordinate->devices)
- __pci_remove_bus_device(pci_dev_b(l));
+ list_for_each_entry_safe(child, tmp,
+ &dev->subordinate->devices, bus_list)
+ __pci_remove_bus_device(child);
}
static void pci_stop_bus_devices(struct pci_bus *bus)
{
- struct list_head *l, *n;
+ struct pci_dev *dev, *tmp;
/*
* VFs could be removed by pci_stop_and_remove_bus_device() in the
@@ -133,10 +134,8 @@ static void pci_stop_bus_devices(struct pci_bus *bus)
* We can iterate the list backwards to get prev valid PF instead
* of removed VF.
*/
- list_for_each_prev_safe(l, n, &bus->devices) {
- struct pci_dev *dev = pci_dev_b(l);
+ list_for_each_entry_safe_reverse(dev, tmp, &bus->devices, bus_list)
pci_stop_bus_device(dev);
- }
}
/**