aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRajesh Shah <rajesh.shah@intel.com>2005-04-28 03:25:49 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-28 00:52:40 -0400
commit6ef6f0e33c4645fc8d23201ad5a6a289b4303cbb (patch)
treeff7861a550b5eea24788ccc07ca0df5294f9067b
parente4ea9bb7e9f177e03a917b1f1213de0315f819ee (diff)
[PATCH] acpi bridge hotadd: Link newly created pci child bus to its parent on creation
When a pci child bus is created, add it to the parent's children list immediately rather than waiting till pci_bus_add_devices(). For hot-plug bridges/devices, pci_bus_add_devices() may be called much later, after they have been properly configured. In the meantime, this allows us to use the normal pci bus search functions for the hot-plug bridges/buses. Signed-off-by: Rajesh Shah <rajesh.shah@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/pci/bus.c11
-rw-r--r--drivers/pci/probe.c4
2 files changed, 9 insertions, 6 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index dbd33605cc10..fedae89d8f7d 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -121,10 +121,13 @@ void __devinit pci_bus_add_devices(struct pci_bus *bus)
121 * If there is an unattached subordinate bus, attach 121 * If there is an unattached subordinate bus, attach
122 * it and then scan for unattached PCI devices. 122 * it and then scan for unattached PCI devices.
123 */ 123 */
124 if (dev->subordinate && list_empty(&dev->subordinate->node)) { 124 if (dev->subordinate) {
125 spin_lock(&pci_bus_lock); 125 if (list_empty(&dev->subordinate->node)) {
126 list_add_tail(&dev->subordinate->node, &dev->bus->children); 126 spin_lock(&pci_bus_lock);
127 spin_unlock(&pci_bus_lock); 127 list_add_tail(&dev->subordinate->node,
128 &dev->bus->children);
129 spin_unlock(&pci_bus_lock);
130 }
128 pci_bus_add_devices(dev->subordinate); 131 pci_bus_add_devices(dev->subordinate);
129 132
130 sysfs_create_link(&dev->subordinate->class_dev.kobj, &dev->dev.kobj, "bridge"); 133 sysfs_create_link(&dev->subordinate->class_dev.kobj, &dev->dev.kobj, "bridge");
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7d171f83257f..6a0a82f0508b 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -450,7 +450,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
450 return max; 450 return max;
451 } 451 }
452 452
453 child = pci_alloc_child_bus(bus, dev, busnr); 453 child = pci_add_new_bus(bus, dev, busnr);
454 if (!child) 454 if (!child)
455 return max; 455 return max;
456 child->primary = buses & 0xFF; 456 child->primary = buses & 0xFF;
@@ -477,7 +477,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
477 * This can happen when a bridge is hot-plugged */ 477 * This can happen when a bridge is hot-plugged */
478 if (pci_find_bus(pci_domain_nr(bus), max+1)) 478 if (pci_find_bus(pci_domain_nr(bus), max+1))
479 return max; 479 return max;
480 child = pci_alloc_child_bus(bus, dev, ++max); 480 child = pci_add_new_bus(bus, dev, ++max);
481 buses = (buses & 0xff000000) 481 buses = (buses & 0xff000000)
482 | ((unsigned int)(child->primary) << 0) 482 | ((unsigned int)(child->primary) << 0)
483 | ((unsigned int)(child->secondary) << 8) 483 | ((unsigned int)(child->secondary) << 8)