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

x86/PCI: Factor out pcibios_allocate_bridge_resources()

Thus pcibios_allocate_bus_resources() could more simple and clean.
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent d1c3ed66
...@@ -193,23 +193,16 @@ EXPORT_SYMBOL(pcibios_align_resource); ...@@ -193,23 +193,16 @@ EXPORT_SYMBOL(pcibios_align_resource);
* as well. * as well.
*/ */
static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) static void __init pcibios_allocate_bridge_resources(struct pci_dev *dev)
{ {
struct pci_bus *bus;
struct pci_dev *dev;
int idx; int idx;
struct resource *r; struct resource *r;
/* Depth-First Search on bus tree */ for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
list_for_each_entry(bus, bus_list, node) {
if ((dev = bus->self)) {
for (idx = PCI_BRIDGE_RESOURCES;
idx < PCI_NUM_RESOURCES; idx++) {
r = &dev->resource[idx]; r = &dev->resource[idx];
if (!r->flags) if (!r->flags)
continue; continue;
if (!r->start || if (!r->start || pci_claim_resource(dev, idx) < 0) {
pci_claim_resource(dev, idx) < 0) {
/* /*
* Something is wrong with the region. * Something is wrong with the region.
* Invalidate the resource to prevent * Invalidate the resource to prevent
...@@ -220,7 +213,16 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) ...@@ -220,7 +213,16 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
r->flags = 0; r->flags = 0;
} }
} }
} }
static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
{
struct pci_bus *bus;
/* Depth-First Search on bus tree */
list_for_each_entry(bus, bus_list, node) {
if (bus->self)
pcibios_allocate_bridge_resources(bus->self);
pcibios_allocate_bus_resources(&bus->children); pcibios_allocate_bus_resources(&bus->children);
} }
} }
......
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