Commit c57ca65a authored by Yinghai Lu's avatar Yinghai Lu Committed by Bjorn Helgaas

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: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent d28e5ac2
...@@ -430,9 +430,7 @@ void __init dmi_check_pciprobe(void) ...@@ -430,9 +430,7 @@ void __init dmi_check_pciprobe(void)
struct pci_bus * __devinit pcibios_scan_root(int busnum) struct pci_bus * __devinit pcibios_scan_root(int busnum)
{ {
LIST_HEAD(resources);
struct pci_bus *bus = NULL; struct pci_bus *bus = NULL;
struct pci_sysdata *sd;
while ((bus = pci_find_next_bus(bus)) != NULL) { while ((bus = pci_find_next_bus(bus)) != NULL) {
if (bus->number == busnum) { if (bus->number == busnum) {
...@@ -441,28 +439,10 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum) ...@@ -441,28 +439,10 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
} }
} }
/* Allocate per-root-bus (not per bus) arch-specific data. return pci_scan_bus_on_node(busnum, &pci_root_ops,
* TODO: leak; this memory is never freed. get_mp_bus_to_node(busnum));
* 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->node = get_mp_bus_to_node(busnum);
printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
x86_pci_root_bus_resources(busnum, &resources);
bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
if (!bus) {
pci_free_resource_list(&resources);
kfree(sd);
}
return bus;
} }
void __init pcibios_set_cache_line_size(void) void __init pcibios_set_cache_line_size(void)
{ {
struct cpuinfo_x86 *c = &boot_cpu_data; 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,6 +636,7 @@ struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops,
} }
sd->node = node; sd->node = node;
x86_pci_root_bus_resources(busno, &resources); x86_pci_root_bus_resources(busno, &resources);
printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busno);
bus = pci_scan_root_bus(NULL, busno, ops, sd, &resources); bus = pci_scan_root_bus(NULL, busno, ops, sd, &resources);
if (!bus) { if (!bus) {
pci_free_resource_list(&resources); pci_free_resource_list(&resources);
......
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