Commit 609b0188 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Make PCI scanning order the same as 2.4

From: Chuck Ebbert <76306.1226@compuserve.com>

2.4 builds its global PCI device list in breadth-first order.

2.5 is doing the scan that way but defers the construction of the global list
until later and then does it depth-first.  This causes devices to found in
different order by drivers.  The below fixed that problem for me.

Russell King has acked this change.
parent 5da505b1
...@@ -75,7 +75,8 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, ...@@ -75,7 +75,8 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
* Add newly discovered PCI devices (which are on the bus->devices * Add newly discovered PCI devices (which are on the bus->devices
* list) to the global PCI device list, add the sysfs and procfs * list) to the global PCI device list, add the sysfs and procfs
* entries. Where a bridge is found, add the discovered bus to * entries. Where a bridge is found, add the discovered bus to
* the parents list of child buses, and recurse. * the parents list of child buses, and recurse (breadth-first
* to be compatible with 2.4)
* *
* Call hotplug for each new devices. * Call hotplug for each new devices.
*/ */
...@@ -98,6 +99,12 @@ void __devinit pci_bus_add_devices(struct pci_bus *bus) ...@@ -98,6 +99,12 @@ void __devinit pci_bus_add_devices(struct pci_bus *bus)
#endif #endif
pci_create_sysfs_dev_files(dev); pci_create_sysfs_dev_files(dev);
}
list_for_each_entry(dev, &bus->devices, bus_list) {
BUG_ON(list_empty(&dev->global_list));
/* /*
* If there is an unattached subordinate bus, attach * If there is an unattached subordinate bus, attach
* it and then scan for unattached PCI devices. * it and then scan for unattached PCI devices.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment