Commit 096e6f67 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 332d2e78
...@@ -1358,11 +1358,10 @@ int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name) ...@@ -1358,11 +1358,10 @@ int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
return 0; return 0;
err_out: err_out:
dev_warn(&pdev->dev, "BAR %d: can't reserve %s region [%#llx-%#llx]\n", dev_warn(&pdev->dev, "BAR %d: can't reserve %s region %pR\n",
bar, bar,
pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem", pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem",
(unsigned long long)pci_resource_start(pdev, bar), &pdev->resource[bar]);
(unsigned long long)pci_resource_end(pdev, bar));
return -EBUSY; return -EBUSY;
} }
......
...@@ -304,9 +304,8 @@ static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, ...@@ -304,9 +304,8 @@ static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
} else { } else {
res->start = l64; res->start = l64;
res->end = l64 + sz64; res->end = l64 + sz64;
printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n", printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: %pR\n",
pci_name(dev), pos, (unsigned long long)res->start, pci_name(dev), pos, res);
(unsigned long long)res->end);
} }
} else { } else {
sz = pci_size(l, sz, mask); 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,9 +315,10 @@ static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
res->start = l; res->start = l;
res->end = l + sz; res->end = l + sz;
printk(KERN_DEBUG "PCI: %s reg %x %s: [%llx, %llx]\n", pci_name(dev), printk(KERN_DEBUG "PCI: %s reg %x %s: %pR\n",
pos, (res->flags & IORESOURCE_IO) ? "io port":"32bit mmio", pci_name(dev), pos,
(unsigned long long)res->start, (unsigned long long)res->end); (res->flags & IORESOURCE_IO) ? "io port":"32bit mmio",
res);
} }
out: out:
...@@ -389,9 +389,8 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) ...@@ -389,9 +389,8 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
res->start = base; res->start = base;
if (!res->end) if (!res->end)
res->end = limit + 0xfff; res->end = limit + 0xfff;
printk(KERN_DEBUG "PCI: bridge %s io port: [%llx, %llx]\n", printk(KERN_DEBUG "PCI: bridge %s io port: %pR\n",
pci_name(dev), (unsigned long long) res->start, pci_name(dev), res);
(unsigned long long) res->end);
} }
res = child->resource[1]; res = child->resource[1];
...@@ -403,9 +402,8 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) ...@@ -403,9 +402,8 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
res->start = base; res->start = base;
res->end = limit + 0xfffff; res->end = limit + 0xfffff;
printk(KERN_DEBUG "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", printk(KERN_DEBUG "PCI: bridge %s 32bit mmio: %pR\n",
pci_name(dev), (unsigned long long) res->start, pci_name(dev), res);
(unsigned long long) res->end);
} }
res = child->resource[2]; res = child->resource[2];
...@@ -441,9 +439,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) ...@@ -441,9 +439,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH;
res->start = base; res->start = base;
res->end = limit + 0xfffff; res->end = limit + 0xfffff;
printk(KERN_DEBUG "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", printk(KERN_DEBUG "PCI: bridge %s %sbit mmio pref: %pR\n",
pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64) ? "64" : "32", pci_name(dev),
(unsigned long long) res->start, (unsigned long long) res->end); (res->flags & PCI_PREF_RANGE_TYPE_64) ? "64":"32", res);
} }
} }
......
...@@ -356,10 +356,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long ...@@ -356,10 +356,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long
order = __ffs(align) - 20; order = __ffs(align) - 20;
if (order > 11) { if (order > 11) {
dev_warn(&dev->dev, "BAR %d bad alignment %llx: " dev_warn(&dev->dev, "BAR %d bad alignment %llx: "
"%#016llx-%#016llx\n", i, "%pR\n", i, (unsigned long long)align, r);
(unsigned long long)align,
(unsigned long long)r->start,
(unsigned long long)r->end);
r->flags = 0; r->flags = 0;
continue; continue;
} }
...@@ -539,11 +536,9 @@ static void pci_bus_dump_res(struct pci_bus *bus) ...@@ -539,11 +536,9 @@ static void pci_bus_dump_res(struct pci_bus *bus)
if (!res) if (!res)
continue; continue;
printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", printk(KERN_INFO "bus: %02x index %x %s: %pR\n",
bus->number, i, bus->number, i,
(res->flags & IORESOURCE_IO) ? "io port" : "mmio", (res->flags & IORESOURCE_IO) ? "io port" : "mmio", res);
(unsigned long long) res->start,
(unsigned long long) res->end);
} }
} }
......
...@@ -49,10 +49,8 @@ void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) ...@@ -49,10 +49,8 @@ void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
pcibios_resource_to_bus(dev, &region, res); pcibios_resource_to_bus(dev, &region, res);
dev_dbg(&dev->dev, "BAR %d: got res [%#llx-%#llx] bus [%#llx-%#llx] " dev_dbg(&dev->dev, "BAR %d: got res %pR bus [%#llx-%#llx] "
"flags %#lx\n", resno, "flags %#lx\n", resno, res,
(unsigned long long)res->start,
(unsigned long long)res->end,
(unsigned long long)region.start, (unsigned long long)region.start,
(unsigned long long)region.end, (unsigned long long)region.end,
(unsigned long)res->flags); (unsigned long)res->flags);
...@@ -114,13 +112,11 @@ int pci_claim_resource(struct pci_dev *dev, int resource) ...@@ -114,13 +112,11 @@ int pci_claim_resource(struct pci_dev *dev, int resource)
err = insert_resource(root, res); err = insert_resource(root, res);
if (err) { if (err) {
dev_err(&dev->dev, "BAR %d: %s of %s [%#llx-%#llx]\n", dev_err(&dev->dev, "BAR %d: %s of %s %pR\n",
resource, resource,
root ? "address space collision on" : root ? "address space collision on" :
"no parent found for", "no parent found for",
dtype, dtype, res);
(unsigned long long)res->start,
(unsigned long long)res->end);
} }
return err; return err;
...@@ -139,9 +135,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno) ...@@ -139,9 +135,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
align = resource_alignment(res); align = resource_alignment(res);
if (!align) { if (!align) {
dev_err(&dev->dev, "BAR %d: can't allocate resource (bogus " dev_err(&dev->dev, "BAR %d: can't allocate resource (bogus "
"alignment) [%#llx-%#llx] flags %#lx\n", "alignment) %pR flags %#lx\n",
resno, (unsigned long long)res->start, resno, res, res->flags);
(unsigned long long)res->end, res->flags);
return -EINVAL; return -EINVAL;
} }
...@@ -162,11 +157,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno) ...@@ -162,11 +157,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
} }
if (ret) { if (ret) {
dev_err(&dev->dev, "BAR %d: can't allocate %s resource " dev_err(&dev->dev, "BAR %d: can't allocate %s resource %pR\n",
"[%#llx-%#llx]\n", resno, resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res);
res->flags & IORESOURCE_IO ? "I/O" : "mem",
(unsigned long long)res->start,
(unsigned long long)res->end);
} else { } else {
res->flags &= ~IORESOURCE_STARTALIGN; res->flags &= ~IORESOURCE_STARTALIGN;
if (resno < PCI_BRIDGE_RESOURCES) if (resno < PCI_BRIDGE_RESOURCES)
...@@ -202,11 +194,8 @@ int pci_assign_resource_fixed(struct pci_dev *dev, int resno) ...@@ -202,11 +194,8 @@ int pci_assign_resource_fixed(struct pci_dev *dev, int resno)
} }
if (ret) { if (ret) {
dev_err(&dev->dev, "BAR %d: can't allocate %s resource " dev_err(&dev->dev, "BAR %d: can't allocate %s resource %pR\n",
"[%#llx-%#llx\n]", resno, resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res);
res->flags & IORESOURCE_IO ? "I/O" : "mem",
(unsigned long long)res->start,
(unsigned long long)res->end);
} else if (resno < PCI_BRIDGE_RESOURCES) { } else if (resno < PCI_BRIDGE_RESOURCES) {
pci_update_resource(dev, res, resno); pci_update_resource(dev, res, resno);
} }
...@@ -237,9 +226,8 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) ...@@ -237,9 +226,8 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
r_align = resource_alignment(r); r_align = resource_alignment(r);
if (!r_align) { if (!r_align) {
dev_warn(&dev->dev, "BAR %d: bogus alignment " dev_warn(&dev->dev, "BAR %d: bogus alignment "
"[%#llx-%#llx] flags %#lx\n", "%pR flags %#lx\n",
i, (unsigned long long)r->start, i, r, r->flags);
(unsigned long long)r->end, r->flags);
continue; continue;
} }
for (list = head; ; list = list->next) { for (list = head; ; list = list->next) {
...@@ -287,9 +275,7 @@ int pci_enable_resources(struct pci_dev *dev, int mask) ...@@ -287,9 +275,7 @@ int pci_enable_resources(struct pci_dev *dev, int mask)
if (!r->parent) { if (!r->parent) {
dev_err(&dev->dev, "device not available because of " dev_err(&dev->dev, "device not available because of "
"BAR %d [%#llx-%#llx] collisions\n", i, "BAR %d %pR collisions\n", i, r);
(unsigned long long) r->start,
(unsigned long long) r->end);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment