diff options
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index f049e3f53fcc..23cdfac0bdb3 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -1154,6 +1154,18 @@ static void pci_release_capabilities(struct pci_dev *dev) | |||
1154 | pci_free_cap_save_buffers(dev); | 1154 | pci_free_cap_save_buffers(dev); |
1155 | } | 1155 | } |
1156 | 1156 | ||
1157 | static void pci_free_resources(struct pci_dev *dev) | ||
1158 | { | ||
1159 | int i; | ||
1160 | |||
1161 | pci_cleanup_rom(dev); | ||
1162 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
1163 | struct resource *res = dev->resource + i; | ||
1164 | if (res->parent) | ||
1165 | release_resource(res); | ||
1166 | } | ||
1167 | } | ||
1168 | |||
1157 | /** | 1169 | /** |
1158 | * pci_release_dev - free a pci device structure when all users of it are finished. | 1170 | * pci_release_dev - free a pci device structure when all users of it are finished. |
1159 | * @dev: device that's been disconnected | 1171 | * @dev: device that's been disconnected |
@@ -1163,9 +1175,14 @@ static void pci_release_capabilities(struct pci_dev *dev) | |||
1163 | */ | 1175 | */ |
1164 | static void pci_release_dev(struct device *dev) | 1176 | static void pci_release_dev(struct device *dev) |
1165 | { | 1177 | { |
1166 | struct pci_dev *pci_dev; | 1178 | struct pci_dev *pci_dev = to_pci_dev(dev); |
1179 | |||
1180 | down_write(&pci_bus_sem); | ||
1181 | list_del(&pci_dev->bus_list); | ||
1182 | up_write(&pci_bus_sem); | ||
1183 | |||
1184 | pci_free_resources(pci_dev); | ||
1167 | 1185 | ||
1168 | pci_dev = to_pci_dev(dev); | ||
1169 | pci_release_capabilities(pci_dev); | 1186 | pci_release_capabilities(pci_dev); |
1170 | pci_release_of_node(pci_dev); | 1187 | pci_release_of_node(pci_dev); |
1171 | pcibios_release_device(pci_dev); | 1188 | pcibios_release_device(pci_dev); |
@@ -1381,8 +1398,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) | |||
1381 | dev->match_driver = false; | 1398 | dev->match_driver = false; |
1382 | ret = device_add(&dev->dev); | 1399 | ret = device_add(&dev->dev); |
1383 | WARN_ON(ret < 0); | 1400 | WARN_ON(ret < 0); |
1384 | |||
1385 | pci_proc_attach_device(dev); | ||
1386 | } | 1401 | } |
1387 | 1402 | ||
1388 | struct pci_dev *__ref pci_scan_single_device(struct pci_bus *bus, int devfn) | 1403 | struct pci_dev *__ref pci_scan_single_device(struct pci_bus *bus, int devfn) |