From: Rajesh Shah 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 Signed-off-by: Andrew Morton --- drivers/pci/bus.c | 11 +++++++---- drivers/pci/probe.c | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff -puN drivers/pci/bus.c~acpi-bridge-hotadd-link-newly-created-pci-child-bus-to-its-parent-on-creation drivers/pci/bus.c --- 25/drivers/pci/bus.c~acpi-bridge-hotadd-link-newly-created-pci-child-bus-to-its-parent-on-creation 2005-04-28 00:24:29.974321688 -0700 +++ 25-akpm/drivers/pci/bus.c 2005-04-28 00:24:29.979320928 -0700 @@ -153,10 +153,13 @@ void __devinit pci_bus_add_devices(struc * 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"); diff -puN drivers/pci/probe.c~acpi-bridge-hotadd-link-newly-created-pci-child-bus-to-its-parent-on-creation drivers/pci/probe.c --- 25/drivers/pci/probe.c~acpi-bridge-hotadd-link-newly-created-pci-child-bus-to-its-parent-on-creation 2005-04-28 00:24:29.975321536 -0700 +++ 25-akpm/drivers/pci/probe.c 2005-04-28 00:24:29.980320776 -0700 @@ -446,7 +446,7 @@ int __devinit pci_scan_bridge(struct pci 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; @@ -473,7 +473,7 @@ int __devinit pci_scan_bridge(struct pci * 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) _