diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-05-17 21:58:41 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-06-13 17:42:26 -0400 |
commit | 073ae10c0f8284b6c6dd9708656802507349ef91 (patch) | |
tree | 595b62a09193db3efa5aa7e683fc945f19787b61 | |
parent | c6da81a4d3cb8d461f77c5f61843fcc9c18b6c2c (diff) |
PCI: cpci_hotplug: use generic pci_hp_add_bridge()
Use the new generic pci_hp_add_bridge() interface.
[bhelgaas: changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/hotplug/cpci_hotplug_pci.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c index 111b7d94c9a9..dcc75c785443 100644 --- a/drivers/pci/hotplug/cpci_hotplug_pci.c +++ b/drivers/pci/hotplug/cpci_hotplug_pci.c | |||
@@ -285,44 +285,19 @@ int __ref cpci_configure_slot(struct slot *slot) | |||
285 | for (fn = 0; fn < 8; fn++) { | 285 | for (fn = 0; fn < 8; fn++) { |
286 | struct pci_dev *dev; | 286 | struct pci_dev *dev; |
287 | 287 | ||
288 | dev = pci_get_slot(parent, PCI_DEVFN(PCI_SLOT(slot->devfn), fn)); | 288 | dev = pci_get_slot(parent, |
289 | PCI_DEVFN(PCI_SLOT(slot->devfn), fn)); | ||
289 | if (!dev) | 290 | if (!dev) |
290 | continue; | 291 | continue; |
291 | if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || | 292 | if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || |
292 | (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) { | 293 | (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) |
293 | /* Find an unused bus number for the new bridge */ | 294 | pci_hp_add_bridge(dev); |
294 | struct pci_bus *child; | ||
295 | unsigned char busnr, start = parent->busn_res.start; | ||
296 | unsigned char end = parent->busn_res.end; | ||
297 | int max; | ||
298 | |||
299 | for (busnr = start; busnr <= end; busnr++) { | ||
300 | if (!pci_find_bus(pci_domain_nr(parent), | ||
301 | busnr)) | ||
302 | break; | ||
303 | } | ||
304 | if (busnr >= end) { | ||
305 | err("No free bus for hot-added bridge\n"); | ||
306 | pci_dev_put(dev); | ||
307 | continue; | ||
308 | } | ||
309 | child = pci_add_new_bus(parent, dev, busnr); | ||
310 | if (!child) { | ||
311 | err("Cannot add new bus for %s\n", | ||
312 | pci_name(dev)); | ||
313 | pci_dev_put(dev); | ||
314 | continue; | ||
315 | } | ||
316 | max = pci_do_scan_bus(child); | ||
317 | pci_bus_update_busn_res_end(child, max); | ||
318 | pci_bus_size_bridges(child); | ||
319 | } | ||
320 | pci_dev_put(dev); | 295 | pci_dev_put(dev); |
321 | } | 296 | } |
322 | 297 | ||
323 | pci_bus_assign_resources(parent); | 298 | pci_assign_unassigned_bridge_resources(parent->self); |
299 | |||
324 | pci_bus_add_devices(parent); | 300 | pci_bus_add_devices(parent); |
325 | pci_enable_bridges(parent); | ||
326 | 301 | ||
327 | dbg("%s - exit", __func__); | 302 | dbg("%s - exit", __func__); |
328 | return 0; | 303 | return 0; |