aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-11-04 00:39:24 -0400
committerBjorn Helgaas <bhelgaas@google.com>2013-01-07 14:18:36 -0500
commitf7ac356dc3da1f69dc52cb6273e08e53b85b4884 (patch)
treecef579eb500d58fc57789bd6a49ee17a4ef54293 /arch/x86
parentd1c3ed669a2d452cacfb48c2d171a1f364dae2ed (diff)
x86/PCI: Factor out pcibios_allocate_bridge_resources()
Thus pcibios_allocate_bus_resources() could more simple and clean. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/pci/i386.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index dd8ca6f7223b..980036286909 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -193,34 +193,36 @@ EXPORT_SYMBOL(pcibios_align_resource);
193 * as well. 193 * as well.
194 */ 194 */
195 195
196static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) 196static void __init pcibios_allocate_bridge_resources(struct pci_dev *dev)
197{ 197{
198 struct pci_bus *bus;
199 struct pci_dev *dev;
200 int idx; 198 int idx;
201 struct resource *r; 199 struct resource *r;
202 200
201 for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
202 r = &dev->resource[idx];
203 if (!r->flags)
204 continue;
205 if (!r->start || pci_claim_resource(dev, idx) < 0) {
206 /*
207 * Something is wrong with the region.
208 * Invalidate the resource to prevent
209 * child resource allocations in this
210 * range.
211 */
212 r->start = r->end = 0;
213 r->flags = 0;
214 }
215 }
216}
217
218static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
219{
220 struct pci_bus *bus;
221
203 /* Depth-First Search on bus tree */ 222 /* Depth-First Search on bus tree */
204 list_for_each_entry(bus, bus_list, node) { 223 list_for_each_entry(bus, bus_list, node) {
205 if ((dev = bus->self)) { 224 if (bus->self)
206 for (idx = PCI_BRIDGE_RESOURCES; 225 pcibios_allocate_bridge_resources(bus->self);
207 idx < PCI_NUM_RESOURCES; idx++) {
208 r = &dev->resource[idx];
209 if (!r->flags)
210 continue;
211 if (!r->start ||
212 pci_claim_resource(dev, idx) < 0) {
213 /*
214 * Something is wrong with the region.
215 * Invalidate the resource to prevent
216 * child resource allocations in this
217 * range.
218 */
219 r->start = r->end = 0;
220 r->flags = 0;
221 }
222 }
223 }
224 pcibios_allocate_bus_resources(&bus->children); 226 pcibios_allocate_bus_resources(&bus->children);
225 } 227 }
226} 228}