diff options
Diffstat (limited to 'drivers/pci/remove.c')
-rw-r--r-- | drivers/pci/remove.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index cc9337a71529..4ff36bfa785e 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -3,20 +3,6 @@ | |||
3 | #include <linux/pci-aspm.h> | 3 | #include <linux/pci-aspm.h> |
4 | #include "pci.h" | 4 | #include "pci.h" |
5 | 5 | ||
6 | static void pci_free_resources(struct pci_dev *dev) | ||
7 | { | ||
8 | int i; | ||
9 | |||
10 | msi_remove_pci_irq_vectors(dev); | ||
11 | |||
12 | pci_cleanup_rom(dev); | ||
13 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
14 | struct resource *res = dev->resource + i; | ||
15 | if (res->parent) | ||
16 | release_resource(res); | ||
17 | } | ||
18 | } | ||
19 | |||
20 | static void pci_stop_dev(struct pci_dev *dev) | 6 | static void pci_stop_dev(struct pci_dev *dev) |
21 | { | 7 | { |
22 | pci_pme_active(dev, false); | 8 | pci_pme_active(dev, false); |
@@ -34,13 +20,11 @@ static void pci_stop_dev(struct pci_dev *dev) | |||
34 | 20 | ||
35 | static void pci_destroy_dev(struct pci_dev *dev) | 21 | static void pci_destroy_dev(struct pci_dev *dev) |
36 | { | 22 | { |
37 | device_del(&dev->dev); | 23 | if (!dev->dev.kobj.parent) |
24 | return; | ||
38 | 25 | ||
39 | down_write(&pci_bus_sem); | 26 | device_del(&dev->dev); |
40 | list_del(&dev->bus_list); | ||
41 | up_write(&pci_bus_sem); | ||
42 | 27 | ||
43 | pci_free_resources(dev); | ||
44 | put_device(&dev->dev); | 28 | put_device(&dev->dev); |
45 | } | 29 | } |
46 | 30 | ||
@@ -114,6 +98,14 @@ void pci_stop_and_remove_bus_device(struct pci_dev *dev) | |||
114 | } | 98 | } |
115 | EXPORT_SYMBOL(pci_stop_and_remove_bus_device); | 99 | EXPORT_SYMBOL(pci_stop_and_remove_bus_device); |
116 | 100 | ||
101 | void pci_stop_and_remove_bus_device_locked(struct pci_dev *dev) | ||
102 | { | ||
103 | pci_lock_rescan_remove(); | ||
104 | pci_stop_and_remove_bus_device(dev); | ||
105 | pci_unlock_rescan_remove(); | ||
106 | } | ||
107 | EXPORT_SYMBOL_GPL(pci_stop_and_remove_bus_device_locked); | ||
108 | |||
117 | void pci_stop_root_bus(struct pci_bus *bus) | 109 | void pci_stop_root_bus(struct pci_bus *bus) |
118 | { | 110 | { |
119 | struct pci_dev *child, *tmp; | 111 | struct pci_dev *child, *tmp; |
@@ -128,7 +120,7 @@ void pci_stop_root_bus(struct pci_bus *bus) | |||
128 | pci_stop_bus_device(child); | 120 | pci_stop_bus_device(child); |
129 | 121 | ||
130 | /* stop the host bridge */ | 122 | /* stop the host bridge */ |
131 | device_del(&host_bridge->dev); | 123 | device_release_driver(&host_bridge->dev); |
132 | } | 124 | } |
133 | 125 | ||
134 | void pci_remove_root_bus(struct pci_bus *bus) | 126 | void pci_remove_root_bus(struct pci_bus *bus) |
@@ -147,5 +139,5 @@ void pci_remove_root_bus(struct pci_bus *bus) | |||
147 | host_bridge->bus = NULL; | 139 | host_bridge->bus = NULL; |
148 | 140 | ||
149 | /* remove the host bridge */ | 141 | /* remove the host bridge */ |
150 | put_device(&host_bridge->dev); | 142 | device_unregister(&host_bridge->dev); |
151 | } | 143 | } |