Skip to content

Commit a76117d

Browse files
Matthew Wilcoxtorvalds
authored andcommitted
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>
1 parent a6c1409 commit a76117d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

arch/x86/pci/i386.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
116116
struct pci_bus *bus;
117117
struct pci_dev *dev;
118118
int idx;
119-
struct resource *r, *pr;
119+
struct resource *r;
120120

121121
/* Depth-First Search on bus tree */
122122
list_for_each_entry(bus, bus_list, node) {
@@ -126,9 +126,8 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
126126
r = &dev->resource[idx];
127127
if (!r->flags)
128128
continue;
129-
pr = pci_find_parent_resource(dev, r);
130-
if (!r->start || !pr ||
131-
request_resource(pr, r) < 0) {
129+
if (!r->start ||
130+
pci_claim_resource(dev, idx) < 0) {
132131
dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx);
133132
/*
134133
* Something is wrong with the region.
@@ -149,7 +148,7 @@ static void __init pcibios_allocate_resources(int pass)
149148
struct pci_dev *dev = NULL;
150149
int idx, disabled;
151150
u16 command;
152-
struct resource *r, *pr;
151+
struct resource *r;
153152

154153
for_each_pci_dev(dev) {
155154
pci_read_config_word(dev, PCI_COMMAND, &command);
@@ -168,8 +167,7 @@ static void __init pcibios_allocate_resources(int pass)
168167
(unsigned long long) r->start,
169168
(unsigned long long) r->end,
170169
r->flags, disabled, pass);
171-
pr = pci_find_parent_resource(dev, r);
172-
if (!pr || request_resource(pr, r) < 0) {
170+
if (pci_claim_resource(dev, idx) < 0) {
173171
dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx);
174172
/* We'll assign a new address later */
175173
r->end -= r->start;
@@ -197,7 +195,7 @@ static void __init pcibios_allocate_resources(int pass)
197195
static int __init pcibios_assign_resources(void)
198196
{
199197
struct pci_dev *dev = NULL;
200-
struct resource *r, *pr;
198+
struct resource *r;
201199

202200
if (!(pci_probe & PCI_ASSIGN_ROMS)) {
203201
/*
@@ -209,8 +207,7 @@ static int __init pcibios_assign_resources(void)
209207
r = &dev->resource[PCI_ROM_RESOURCE];
210208
if (!r->flags || !r->start)
211209
continue;
212-
pr = pci_find_parent_resource(dev, r);
213-
if (!pr || request_resource(pr, r) < 0) {
210+
if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) {
214211
r->end -= r->start;
215212
r->start = 0;
216213
}

0 commit comments

Comments
 (0)