diff options
author | Matthew Wilcox <willy@linux.intel.com> | 2009-06-17 16:33:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-17 17:04:42 -0400 |
commit | a76117dfd687ec4be0a9a05214f3009cc5f73a42 (patch) | |
tree | 2ffc76ac97e2fed7debac7276d7d365275db6b92 /arch | |
parent | a6c140969b4685f9b9f6773c0760f55ca66d1825 (diff) |
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/pci/i386.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index a85bef20a3b9..0fb56db16d18 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
@@ -116,7 +116,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) | |||
116 | struct pci_bus *bus; | 116 | struct pci_bus *bus; |
117 | struct pci_dev *dev; | 117 | struct pci_dev *dev; |
118 | int idx; | 118 | int idx; |
119 | struct resource *r, *pr; | 119 | struct resource *r; |
120 | 120 | ||
121 | /* Depth-First Search on bus tree */ | 121 | /* Depth-First Search on bus tree */ |
122 | list_for_each_entry(bus, bus_list, node) { | 122 | list_for_each_entry(bus, bus_list, node) { |
@@ -126,9 +126,8 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) | |||
126 | r = &dev->resource[idx]; | 126 | r = &dev->resource[idx]; |
127 | if (!r->flags) | 127 | if (!r->flags) |
128 | continue; | 128 | continue; |
129 | pr = pci_find_parent_resource(dev, r); | 129 | if (!r->start || |
130 | if (!r->start || !pr || | 130 | pci_claim_resource(dev, idx) < 0) { |
131 | request_resource(pr, r) < 0) { | ||
132 | dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); | 131 | dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); |
133 | /* | 132 | /* |
134 | * Something is wrong with the region. | 133 | * Something is wrong with the region. |
@@ -149,7 +148,7 @@ static void __init pcibios_allocate_resources(int pass) | |||
149 | struct pci_dev *dev = NULL; | 148 | struct pci_dev *dev = NULL; |
150 | int idx, disabled; | 149 | int idx, disabled; |
151 | u16 command; | 150 | u16 command; |
152 | struct resource *r, *pr; | 151 | struct resource *r; |
153 | 152 | ||
154 | for_each_pci_dev(dev) { | 153 | for_each_pci_dev(dev) { |
155 | pci_read_config_word(dev, PCI_COMMAND, &command); | 154 | pci_read_config_word(dev, PCI_COMMAND, &command); |
@@ -168,8 +167,7 @@ static void __init pcibios_allocate_resources(int pass) | |||
168 | (unsigned long long) r->start, | 167 | (unsigned long long) r->start, |
169 | (unsigned long long) r->end, | 168 | (unsigned long long) r->end, |
170 | r->flags, disabled, pass); | 169 | r->flags, disabled, pass); |
171 | pr = pci_find_parent_resource(dev, r); | 170 | if (pci_claim_resource(dev, idx) < 0) { |
172 | if (!pr || request_resource(pr, r) < 0) { | ||
173 | dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); | 171 | dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); |
174 | /* We'll assign a new address later */ | 172 | /* We'll assign a new address later */ |
175 | r->end -= r->start; | 173 | r->end -= r->start; |
@@ -197,7 +195,7 @@ static void __init pcibios_allocate_resources(int pass) | |||
197 | static int __init pcibios_assign_resources(void) | 195 | static int __init pcibios_assign_resources(void) |
198 | { | 196 | { |
199 | struct pci_dev *dev = NULL; | 197 | struct pci_dev *dev = NULL; |
200 | struct resource *r, *pr; | 198 | struct resource *r; |
201 | 199 | ||
202 | if (!(pci_probe & PCI_ASSIGN_ROMS)) { | 200 | if (!(pci_probe & PCI_ASSIGN_ROMS)) { |
203 | /* | 201 | /* |
@@ -209,8 +207,7 @@ static int __init pcibios_assign_resources(void) | |||
209 | r = &dev->resource[PCI_ROM_RESOURCE]; | 207 | r = &dev->resource[PCI_ROM_RESOURCE]; |
210 | if (!r->flags || !r->start) | 208 | if (!r->flags || !r->start) |
211 | continue; | 209 | continue; |
212 | pr = pci_find_parent_resource(dev, r); | 210 | if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) { |
213 | if (!pr || request_resource(pr, r) < 0) { | ||
214 | r->end -= r->start; | 211 | r->end -= r->start; |
215 | r->start = 0; | 212 | r->start = 0; |
216 | } | 213 | } |