aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-20 00:07:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 12:12:32 -0400
commit096e6f673dc02a6394dc9a7d8f8735c6978f5b91 (patch)
tree50e9f463b089dc1b62c3f260a27d500040534525 /drivers
parent332d2e7834986a9326ec3fa6a91641daef81746c (diff)
pci: Use new %pR to print resource ranges
This converts things in drivers/pci to use %pR to printout the content of a struct resource instead of hand-casted %llx or other variants. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/pci.c5
-rw-r--r--drivers/pci/probe.c28
-rw-r--r--drivers/pci/setup-bus.c13
-rw-r--r--drivers/pci/setup-res.c40
4 files changed, 32 insertions, 54 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c9884bba22de..dbe9f39f4436 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1358,11 +1358,10 @@ int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
1358 return 0; 1358 return 0;
1359 1359
1360err_out: 1360err_out:
1361 dev_warn(&pdev->dev, "BAR %d: can't reserve %s region [%#llx-%#llx]\n", 1361 dev_warn(&pdev->dev, "BAR %d: can't reserve %s region %pR\n",
1362 bar, 1362 bar,
1363 pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem", 1363 pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem",
1364 (unsigned long long)pci_resource_start(pdev, bar), 1364 &pdev->resource[bar]);
1365 (unsigned long long)pci_resource_end(pdev, bar));
1366 return -EBUSY; 1365 return -EBUSY;
1367} 1366}
1368 1367
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index dd9161a054e1..d3db8b249729 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -304,9 +304,8 @@ static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
304 } else { 304 } else {
305 res->start = l64; 305 res->start = l64;
306 res->end = l64 + sz64; 306 res->end = l64 + sz64;
307 printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n", 307 printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: %pR\n",
308 pci_name(dev), pos, (unsigned long long)res->start, 308 pci_name(dev), pos, res);
309 (unsigned long long)res->end);
310 } 309 }
311 } else { 310 } else {
312 sz = pci_size(l, sz, mask); 311 sz = pci_size(l, sz, mask);
@@ -316,9 +315,10 @@ static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
316 315
317 res->start = l; 316 res->start = l;
318 res->end = l + sz; 317 res->end = l + sz;
319 printk(KERN_DEBUG "PCI: %s reg %x %s: [%llx, %llx]\n", pci_name(dev), 318 printk(KERN_DEBUG "PCI: %s reg %x %s: %pR\n",
320 pos, (res->flags & IORESOURCE_IO) ? "io port":"32bit mmio", 319 pci_name(dev), pos,
321 (unsigned long long)res->start, (unsigned long long)res->end); 320 (res->flags & IORESOURCE_IO) ? "io port":"32bit mmio",
321 res);
322 } 322 }
323 323
324 out: 324 out:
@@ -389,9 +389,8 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
389 res->start = base; 389 res->start = base;
390 if (!res->end) 390 if (!res->end)
391 res->end = limit + 0xfff; 391 res->end = limit + 0xfff;
392 printk(KERN_DEBUG "PCI: bridge %s io port: [%llx, %llx]\n", 392 printk(KERN_DEBUG "PCI: bridge %s io port: %pR\n",
393 pci_name(dev), (unsigned long long) res->start, 393 pci_name(dev), res);
394 (unsigned long long) res->end);
395 } 394 }
396 395
397 res = child->resource[1]; 396 res = child->resource[1];
@@ -403,9 +402,8 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
403 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; 402 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
404 res->start = base; 403 res->start = base;
405 res->end = limit + 0xfffff; 404 res->end = limit + 0xfffff;
406 printk(KERN_DEBUG "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", 405 printk(KERN_DEBUG "PCI: bridge %s 32bit mmio: %pR\n",
407 pci_name(dev), (unsigned long long) res->start, 406 pci_name(dev), res);
408 (unsigned long long) res->end);
409 } 407 }
410 408
411 res = child->resource[2]; 409 res = child->resource[2];
@@ -441,9 +439,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
441 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; 439 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH;
442 res->start = base; 440 res->start = base;
443 res->end = limit + 0xfffff; 441 res->end = limit + 0xfffff;
444 printk(KERN_DEBUG "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", 442 printk(KERN_DEBUG "PCI: bridge %s %sbit mmio pref: %pR\n",
445 pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64) ? "64" : "32", 443 pci_name(dev),
446 (unsigned long long) res->start, (unsigned long long) res->end); 444 (res->flags & PCI_PREF_RANGE_TYPE_64) ? "64":"32", res);
447 } 445 }
448} 446}
449 447
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index d5e2106760f8..471a429d7a20 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -356,10 +356,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long
356 order = __ffs(align) - 20; 356 order = __ffs(align) - 20;
357 if (order > 11) { 357 if (order > 11) {
358 dev_warn(&dev->dev, "BAR %d bad alignment %llx: " 358 dev_warn(&dev->dev, "BAR %d bad alignment %llx: "
359 "%#016llx-%#016llx\n", i, 359 "%pR\n", i, (unsigned long long)align, r);
360 (unsigned long long)align,
361 (unsigned long long)r->start,
362 (unsigned long long)r->end);
363 r->flags = 0; 360 r->flags = 0;
364 continue; 361 continue;
365 } 362 }
@@ -539,11 +536,9 @@ static void pci_bus_dump_res(struct pci_bus *bus)
539 if (!res) 536 if (!res)
540 continue; 537 continue;
541 538
542 printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", 539 printk(KERN_INFO "bus: %02x index %x %s: %pR\n",
543 bus->number, i, 540 bus->number, i,
544 (res->flags & IORESOURCE_IO) ? "io port" : "mmio", 541 (res->flags & IORESOURCE_IO) ? "io port" : "mmio", res);
545 (unsigned long long) res->start,
546 (unsigned long long) res->end);
547 } 542 }
548} 543}
549 544
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 1a5fc83c71b3..d4b5c690eaa7 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -49,10 +49,8 @@ void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
49 49
50 pcibios_resource_to_bus(dev, &region, res); 50 pcibios_resource_to_bus(dev, &region, res);
51 51
52 dev_dbg(&dev->dev, "BAR %d: got res [%#llx-%#llx] bus [%#llx-%#llx] " 52 dev_dbg(&dev->dev, "BAR %d: got res %pR bus [%#llx-%#llx] "
53 "flags %#lx\n", resno, 53 "flags %#lx\n", resno, res,
54 (unsigned long long)res->start,
55 (unsigned long long)res->end,
56 (unsigned long long)region.start, 54 (unsigned long long)region.start,
57 (unsigned long long)region.end, 55 (unsigned long long)region.end,
58 (unsigned long)res->flags); 56 (unsigned long)res->flags);
@@ -114,13 +112,11 @@ int pci_claim_resource(struct pci_dev *dev, int resource)
114 err = insert_resource(root, res); 112 err = insert_resource(root, res);
115 113
116 if (err) { 114 if (err) {
117 dev_err(&dev->dev, "BAR %d: %s of %s [%#llx-%#llx]\n", 115 dev_err(&dev->dev, "BAR %d: %s of %s %pR\n",
118 resource, 116 resource,
119 root ? "address space collision on" : 117 root ? "address space collision on" :
120 "no parent found for", 118 "no parent found for",
121 dtype, 119 dtype, res);
122 (unsigned long long)res->start,
123 (unsigned long long)res->end);
124 } 120 }
125 121
126 return err; 122 return err;
@@ -139,9 +135,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
139 align = resource_alignment(res); 135 align = resource_alignment(res);
140 if (!align) { 136 if (!align) {
141 dev_err(&dev->dev, "BAR %d: can't allocate resource (bogus " 137 dev_err(&dev->dev, "BAR %d: can't allocate resource (bogus "
142 "alignment) [%#llx-%#llx] flags %#lx\n", 138 "alignment) %pR flags %#lx\n",
143 resno, (unsigned long long)res->start, 139 resno, res, res->flags);
144 (unsigned long long)res->end, res->flags);
145 return -EINVAL; 140 return -EINVAL;
146 } 141 }
147 142
@@ -162,11 +157,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
162 } 157 }
163 158
164 if (ret) { 159 if (ret) {
165 dev_err(&dev->dev, "BAR %d: can't allocate %s resource " 160 dev_err(&dev->dev, "BAR %d: can't allocate %s resource %pR\n",
166 "[%#llx-%#llx]\n", resno, 161 resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res);
167 res->flags & IORESOURCE_IO ? "I/O" : "mem",
168 (unsigned long long)res->start,
169 (unsigned long long)res->end);
170 } else { 162 } else {
171 res->flags &= ~IORESOURCE_STARTALIGN; 163 res->flags &= ~IORESOURCE_STARTALIGN;
172 if (resno < PCI_BRIDGE_RESOURCES) 164 if (resno < PCI_BRIDGE_RESOURCES)
@@ -202,11 +194,8 @@ int pci_assign_resource_fixed(struct pci_dev *dev, int resno)
202 } 194 }
203 195
204 if (ret) { 196 if (ret) {
205 dev_err(&dev->dev, "BAR %d: can't allocate %s resource " 197 dev_err(&dev->dev, "BAR %d: can't allocate %s resource %pR\n",
206 "[%#llx-%#llx\n]", resno, 198 resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res);
207 res->flags & IORESOURCE_IO ? "I/O" : "mem",
208 (unsigned long long)res->start,
209 (unsigned long long)res->end);
210 } else if (resno < PCI_BRIDGE_RESOURCES) { 199 } else if (resno < PCI_BRIDGE_RESOURCES) {
211 pci_update_resource(dev, res, resno); 200 pci_update_resource(dev, res, resno);
212 } 201 }
@@ -237,9 +226,8 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
237 r_align = resource_alignment(r); 226 r_align = resource_alignment(r);
238 if (!r_align) { 227 if (!r_align) {
239 dev_warn(&dev->dev, "BAR %d: bogus alignment " 228 dev_warn(&dev->dev, "BAR %d: bogus alignment "
240 "[%#llx-%#llx] flags %#lx\n", 229 "%pR flags %#lx\n",
241 i, (unsigned long long)r->start, 230 i, r, r->flags);
242 (unsigned long long)r->end, r->flags);
243 continue; 231 continue;
244 } 232 }
245 for (list = head; ; list = list->next) { 233 for (list = head; ; list = list->next) {
@@ -287,9 +275,7 @@ int pci_enable_resources(struct pci_dev *dev, int mask)
287 275
288 if (!r->parent) { 276 if (!r->parent) {
289 dev_err(&dev->dev, "device not available because of " 277 dev_err(&dev->dev, "device not available because of "
290 "BAR %d [%#llx-%#llx] collisions\n", i, 278 "BAR %d %pR collisions\n", i, r);
291 (unsigned long long) r->start,
292 (unsigned long long) r->end);
293 return -EINVAL; 279 return -EINVAL;
294 } 280 }
295 281