From : Zhao Yakui [PATCH] Unneccessary to scan the PCI bus already scanned v2 http://bugzilla.kernel.org/show_bug.cgi?id=10124 commit 08f1c192c3c32797068bfe97738babb3295bbf42 Author: Muli Ben-Yehuda Date: Sun Jul 22 00:23:39 2007 +0300 x86-64: introduce struct pci_sysdata to facilitate sharing of ->sysdata This patch introduces struct pci_sysdata to x86 and x86-64, and converts the existing two users (NUMA, Calgary) to use it. This lays the groundwork for having other users of sysdata, such as the PCI domains work. The Calgary bits are tested, the NUMA bits just look ok. that replace pcibios_scan_root by pci_scan_bus_parented... but in pcibios_scan_root we have check about scanned bus Yinghai make it can be applied after patches in x86.git#tesing Signed-off-by: Zhao Yakui Signed-off-by: Li Shaohua Signed-off-by: Yinghai Lu Index: linux-2.6/arch/x86/pci/acpi.c =================================================================== --- linux-2.6.orig/arch/x86/pci/acpi.c +++ linux-2.6/arch/x86/pci/acpi.c @@ -218,28 +218,36 @@ struct pci_bus * __devinit pci_acpi_scan node = -1; #endif - /* Allocate per-root-bus (not per bus) arch-specific data. - * TODO: leak; this memory is never freed. - * It's arguable whether it's worth the trouble to care. - */ - sd = kzalloc(sizeof(*sd), GFP_KERNEL); - if (!sd) { - printk(KERN_ERR "PCI: OOM, not probing PCI bus %02x\n", busnum); - return NULL; - } + bus = pci_find_bus(domain, busnum); + if (bus) { + /* already scanned ?*/ + sd = bus->sysdata; + sd->node = node; + } else { + /* Allocate per-root-bus (not per bus) arch-specific data. + * TODO: leak; this memory is never freed. + * It's arguable whether it's worth the trouble to care. + */ + sd = kzalloc(sizeof(*sd), GFP_KERNEL); + if (!sd) { + printk(KERN_ERR "PCI: OOM, not probing PCI bus %02x\n", + busnum); + return NULL; + } - sd->domain = domain; - sd->node = node; + sd->domain = domain; + sd->node = node; - bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd); - if (!bus) - kfree(sd); + bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd); + if (!bus) + kfree(sd); + } #ifdef CONFIG_ACPI_NUMA if (bus) { if (pxm >= 0) { printk(KERN_DEBUG "bus %02x -> pxm %d -> node %d\n", - busnum, pxm, sd->node); + busnum, pxm, node); } } #endif