diff options
Diffstat (limited to 'drivers/pci/remove.c')
-rw-r--r-- | drivers/pci/remove.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 513972f3ed13..7c0fd9252e6f 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -111,3 +111,39 @@ void pci_stop_and_remove_bus_device(struct pci_dev *dev) | |||
111 | pci_remove_bus_device(dev); | 111 | pci_remove_bus_device(dev); |
112 | } | 112 | } |
113 | EXPORT_SYMBOL(pci_stop_and_remove_bus_device); | 113 | EXPORT_SYMBOL(pci_stop_and_remove_bus_device); |
114 | |||
115 | void pci_stop_root_bus(struct pci_bus *bus) | ||
116 | { | ||
117 | struct pci_dev *child, *tmp; | ||
118 | struct pci_host_bridge *host_bridge; | ||
119 | |||
120 | if (!pci_is_root_bus(bus)) | ||
121 | return; | ||
122 | |||
123 | host_bridge = to_pci_host_bridge(bus->bridge); | ||
124 | list_for_each_entry_safe_reverse(child, tmp, | ||
125 | &bus->devices, bus_list) | ||
126 | pci_stop_bus_device(child); | ||
127 | |||
128 | /* stop the host bridge */ | ||
129 | device_del(&host_bridge->dev); | ||
130 | } | ||
131 | |||
132 | void pci_remove_root_bus(struct pci_bus *bus) | ||
133 | { | ||
134 | struct pci_dev *child, *tmp; | ||
135 | struct pci_host_bridge *host_bridge; | ||
136 | |||
137 | if (!pci_is_root_bus(bus)) | ||
138 | return; | ||
139 | |||
140 | host_bridge = to_pci_host_bridge(bus->bridge); | ||
141 | list_for_each_entry_safe(child, tmp, | ||
142 | &bus->devices, bus_list) | ||
143 | pci_remove_bus_device(child); | ||
144 | pci_remove_bus(bus); | ||
145 | host_bridge->bus = NULL; | ||
146 | |||
147 | /* remove the host bridge */ | ||
148 | put_device(&host_bridge->dev); | ||
149 | } | ||