x86: Use pci_claim_resource

Instead of open-coding pci_find_parent_resource and request_resource,
just call pci_claim_resource.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Matthew Wilcox and committed by Linus Torvalds a76117df a6c14096

+7 -10
+7 -10
arch/x86/pci/i386.c
··· 116 struct pci_bus *bus; 117 struct pci_dev *dev; 118 int idx; 119 - struct resource *r, *pr; 120 121 /* Depth-First Search on bus tree */ 122 list_for_each_entry(bus, bus_list, node) { ··· 126 r = &dev->resource[idx]; 127 if (!r->flags) 128 continue; 129 - pr = pci_find_parent_resource(dev, r); 130 - if (!r->start || !pr || 131 - request_resource(pr, r) < 0) { 132 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); 133 /* 134 * Something is wrong with the region. ··· 148 struct pci_dev *dev = NULL; 149 int idx, disabled; 150 u16 command; 151 - struct resource *r, *pr; 152 153 for_each_pci_dev(dev) { 154 pci_read_config_word(dev, PCI_COMMAND, &command); ··· 167 (unsigned long long) r->start, 168 (unsigned long long) r->end, 169 r->flags, disabled, pass); 170 - pr = pci_find_parent_resource(dev, r); 171 - if (!pr || request_resource(pr, r) < 0) { 172 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); 173 /* We'll assign a new address later */ 174 r->end -= r->start; ··· 195 static int __init pcibios_assign_resources(void) 196 { 197 struct pci_dev *dev = NULL; 198 - struct resource *r, *pr; 199 200 if (!(pci_probe & PCI_ASSIGN_ROMS)) { 201 /* ··· 207 r = &dev->resource[PCI_ROM_RESOURCE]; 208 if (!r->flags || !r->start) 209 continue; 210 - pr = pci_find_parent_resource(dev, r); 211 - if (!pr || request_resource(pr, r) < 0) { 212 r->end -= r->start; 213 r->start = 0; 214 }
··· 116 struct pci_bus *bus; 117 struct pci_dev *dev; 118 int idx; 119 + struct resource *r; 120 121 /* Depth-First Search on bus tree */ 122 list_for_each_entry(bus, bus_list, node) { ··· 126 r = &dev->resource[idx]; 127 if (!r->flags) 128 continue; 129 + if (!r->start || 130 + pci_claim_resource(dev, idx) < 0) { 131 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); 132 /* 133 * Something is wrong with the region. ··· 149 struct pci_dev *dev = NULL; 150 int idx, disabled; 151 u16 command; 152 + struct resource *r; 153 154 for_each_pci_dev(dev) { 155 pci_read_config_word(dev, PCI_COMMAND, &command); ··· 168 (unsigned long long) r->start, 169 (unsigned long long) r->end, 170 r->flags, disabled, pass); 171 + if (pci_claim_resource(dev, idx) < 0) { 172 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); 173 /* We'll assign a new address later */ 174 r->end -= r->start; ··· 197 static int __init pcibios_assign_resources(void) 198 { 199 struct pci_dev *dev = NULL; 200 + struct resource *r; 201 202 if (!(pci_probe & PCI_ASSIGN_ROMS)) { 203 /* ··· 209 r = &dev->resource[PCI_ROM_RESOURCE]; 210 if (!r->flags || !r->start) 211 continue; 212 + if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) { 213 r->end -= r->start; 214 r->start = 0; 215 }