lkml.org 
[lkml]   [2012]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 14/23] PCI: add __pci_remove_bus_devices()
Date
will use it with pci_stop_and_remove_bus later.

also remove __pci_remove_behind_bridge and pci_stop_behind_bridge.

they are same except one take bridge and one take bus.

and we already have pci_stop_bus_devices()

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
drivers/pci/remove.c | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index 243d59b..62c348c 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -78,7 +78,7 @@ void pci_remove_bus(struct pci_bus *pci_bus)
}
EXPORT_SYMBOL(pci_remove_bus);

-static void __pci_remove_behind_bridge(struct pci_dev *dev);
+static void __pci_remove_bus_devices(struct pci_bus *bus);
/**
* pci_stop_and_remove_bus_device - remove a PCI device and any children
* @dev: the device to remove
@@ -96,7 +96,7 @@ void __pci_remove_bus_device(struct pci_dev *dev)
if (dev->subordinate) {
struct pci_bus *b = dev->subordinate;

- __pci_remove_behind_bridge(dev);
+ __pci_remove_bus_devices(b);
pci_remove_bus(b);
dev->subordinate = NULL;
}
@@ -111,22 +111,12 @@ void pci_stop_and_remove_bus_device(struct pci_dev *dev)
__pci_remove_bus_device(dev);
}

-static void __pci_remove_behind_bridge(struct pci_dev *dev)
+static void __pci_remove_bus_devices(struct pci_bus *bus)
{
struct list_head *l, *n;

- if (dev->subordinate)
- list_for_each_safe(l, n, &dev->subordinate->devices)
- __pci_remove_bus_device(pci_dev_b(l));
-}
-
-static void pci_stop_behind_bridge(struct pci_dev *dev)
-{
- struct list_head *l, *n;
-
- if (dev->subordinate)
- list_for_each_safe(l, n, &dev->subordinate->devices)
- pci_stop_bus_device(pci_dev_b(l));
+ list_for_each_safe(l, n, &bus->devices)
+ __pci_remove_bus_device(pci_dev_b(l));
}

static void pci_stop_bus_devices(struct pci_bus *bus)
@@ -158,8 +148,12 @@ static void pci_stop_bus_devices(struct pci_bus *bus)
*/
void pci_stop_and_remove_behind_bridge(struct pci_dev *dev)
{
- pci_stop_behind_bridge(dev);
- __pci_remove_behind_bridge(dev);
+ struct pci_bus *bus = dev->subordinate;
+
+ if (bus) {
+ pci_stop_bus_devices(bus);
+ __pci_remove_bus_devices(bus);
+ }
}

/**
--
1.7.7


\
 
 \ /
  Last update: 2012-03-06 08:19    [W:0.211 / U:0.324 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site