[PATCH] acpi bridge hotadd: Link newly created pci child bus to its parent on creation
authorRajesh Shah <rajesh.shah@intel.com>
Thu, 28 Apr 2005 07:25:49 +0000 (00:25 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 28 Jun 2005 04:52:40 +0000 (21:52 -0700)
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>
drivers/pci/bus.c
drivers/pci/probe.c

index dbd33605cc107c058e028ab447ca39eb1c814001..fedae89d8f7d5678b7b7126a084b8a49a9939858 100644 (file)
@@ -121,10 +121,13 @@ void __devinit pci_bus_add_devices(struct pci_bus *bus)
                 * If there is an unattached subordinate bus, attach
                 * it and then scan for unattached PCI devices.
                 */
-               if (dev->subordinate && list_empty(&dev->subordinate->node)) {
-                       spin_lock(&pci_bus_lock);
-                       list_add_tail(&dev->subordinate->node, &dev->bus->children);
-                       spin_unlock(&pci_bus_lock);
+               if (dev->subordinate) {
+                      if (list_empty(&dev->subordinate->node)) {
+                              spin_lock(&pci_bus_lock);
+                              list_add_tail(&dev->subordinate->node,
+                                              &dev->bus->children);
+                              spin_unlock(&pci_bus_lock);
+                      }
                        pci_bus_add_devices(dev->subordinate);
 
                        sysfs_create_link(&dev->subordinate->class_dev.kobj, &dev->dev.kobj, "bridge");
index 7d171f83257f0957a11f3806d097a314242dfb80..6a0a82f0508bf2d81112cd5f2236acad46a635b6 100644 (file)
@@ -450,7 +450,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
                        return max;
                }
 
-               child = pci_alloc_child_bus(bus, dev, busnr);
+               child = pci_add_new_bus(bus, dev, busnr);
                if (!child)
                        return max;
                child->primary = buses & 0xFF;
@@ -477,7 +477,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
                 * This can happen when a bridge is hot-plugged */
                if (pci_find_bus(pci_domain_nr(bus), max+1))
                        return max;
-               child = pci_alloc_child_bus(bus, dev, ++max);
+               child = pci_add_new_bus(bus, dev, ++max);
                buses = (buses & 0xff000000)
                      | ((unsigned int)(child->primary)     <<  0)
                      | ((unsigned int)(child->secondary)   <<  8)