aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/cpci_hotplug_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/cpci_hotplug_pci.c')
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_pci.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
index ae853ccd0cd5..dcc75c785443 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -285,42 +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->secondary;
296 unsigned char end = parent->subordinate;
297
298 for (busnr = start; busnr <= end; busnr++) {
299 if (!pci_find_bus(pci_domain_nr(parent),
300 busnr))
301 break;
302 }
303 if (busnr >= end) {
304 err("No free bus for hot-added bridge\n");
305 pci_dev_put(dev);
306 continue;
307 }
308 child = pci_add_new_bus(parent, dev, busnr);
309 if (!child) {
310 err("Cannot add new bus for %s\n",
311 pci_name(dev));
312 pci_dev_put(dev);
313 continue;
314 }
315 child->subordinate = pci_do_scan_bus(child);
316 pci_bus_size_bridges(child);
317 }
318 pci_dev_put(dev); 295 pci_dev_put(dev);
319 } 296 }
320 297
321 pci_bus_assign_resources(parent); 298 pci_assign_unassigned_bridge_resources(parent->self);
299
322 pci_bus_add_devices(parent); 300 pci_bus_add_devices(parent);
323 pci_enable_bridges(parent);
324 301
325 dbg("%s - exit", __func__); 302 dbg("%s - exit", __func__);
326 return 0; 303 return 0;