aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/pci/common.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-04-02 21:31:54 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-04-30 16:52:43 -0400
commitc57ca65a6ea3171370cbb3010e5a3aea7399a5e1 (patch)
tree740cfed9cc174fcd35276989cbff2c8401039387 /arch/x86/pci/common.c
parentd28e5ac2a07e27638cf5ac061721b7969e17fe78 (diff)
x86/PCI: merge pcibios_scan_root() and pci_scan_bus_on_node()
pcibios_scan_root() and pci_scan_bus_on_node() were almost identical, so this patch merges them. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/x86/pci/common.c')
-rw-r--r--arch/x86/pci/common.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 323481e06ef..8e04ec59154 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -430,9 +430,7 @@ void __init dmi_check_pciprobe(void)
430 430
431struct pci_bus * __devinit pcibios_scan_root(int busnum) 431struct pci_bus * __devinit pcibios_scan_root(int busnum)
432{ 432{
433 LIST_HEAD(resources);
434 struct pci_bus *bus = NULL; 433 struct pci_bus *bus = NULL;
435 struct pci_sysdata *sd;
436 434
437 while ((bus = pci_find_next_bus(bus)) != NULL) { 435 while ((bus = pci_find_next_bus(bus)) != NULL) {
438 if (bus->number == busnum) { 436 if (bus->number == busnum) {
@@ -441,28 +439,10 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
441 } 439 }
442 } 440 }
443 441
444 /* Allocate per-root-bus (not per bus) arch-specific data. 442 return pci_scan_bus_on_node(busnum, &pci_root_ops,
445 * TODO: leak; this memory is never freed. 443 get_mp_bus_to_node(busnum));
446 * It's arguable whether it's worth the trouble to care.
447 */
448 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
449 if (!sd) {
450 printk(KERN_ERR "PCI: OOM, not probing PCI bus %02x\n", busnum);
451 return NULL;
452 }
453
454 sd->node = get_mp_bus_to_node(busnum);
455
456 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
457 x86_pci_root_bus_resources(busnum, &resources);
458 bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
459 if (!bus) {
460 pci_free_resource_list(&resources);
461 kfree(sd);
462 }
463
464 return bus;
465} 444}
445
466void __init pcibios_set_cache_line_size(void) 446void __init pcibios_set_cache_line_size(void)
467{ 447{
468 struct cpuinfo_x86 *c = &boot_cpu_data; 448 struct cpuinfo_x86 *c = &boot_cpu_data;
@@ -656,6 +636,7 @@ struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops,
656 } 636 }
657 sd->node = node; 637 sd->node = node;
658 x86_pci_root_bus_resources(busno, &resources); 638 x86_pci_root_bus_resources(busno, &resources);
639 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busno);
659 bus = pci_scan_root_bus(NULL, busno, ops, sd, &resources); 640 bus = pci_scan_root_bus(NULL, busno, ops, sd, &resources);
660 if (!bus) { 641 if (!bus) {
661 pci_free_resource_list(&resources); 642 pci_free_resource_list(&resources);