Commit 9a007b37 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Jesse Barnes

PNP: print resources consistently with %pRt

This uses %pRt and %pRf to print additional resource information (type,
size, prefetchability, etc.) consistently.
Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 637b363e
...@@ -285,15 +285,9 @@ static void quirk_system_pci_resources(struct pnp_dev *dev) ...@@ -285,15 +285,9 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
* the PCI region, and that might prevent a PCI * the PCI region, and that might prevent a PCI
* driver from requesting its resources. * driver from requesting its resources.
*/ */
dev_warn(&dev->dev, "%s resource " dev_warn(&dev->dev, "resource %pRt overlaps %s "
"(0x%llx-0x%llx) overlaps %s BAR %d " "BAR %d %pRt, disabling\n", res,
"(0x%llx-0x%llx), disabling\n", pci_name(pdev), i, &pdev->resource[i]);
pnp_resource_type_name(res),
(unsigned long long) pnp_start,
(unsigned long long) pnp_end,
pci_name(pdev), i,
(unsigned long long) pci_start,
(unsigned long long) pci_end);
res->flags |= IORESOURCE_DISABLED; res->flags |= IORESOURCE_DISABLED;
} }
} }
......
...@@ -517,7 +517,7 @@ struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq, ...@@ -517,7 +517,7 @@ struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq,
res->start = irq; res->start = irq;
res->end = irq; res->end = irq;
pnp_dbg(&dev->dev, " add irq %d flags %#x\n", irq, flags); pnp_dbg(&dev->dev, " add %pRf\n", res);
return pnp_res; return pnp_res;
} }
...@@ -538,7 +538,7 @@ struct pnp_resource *pnp_add_dma_resource(struct pnp_dev *dev, int dma, ...@@ -538,7 +538,7 @@ struct pnp_resource *pnp_add_dma_resource(struct pnp_dev *dev, int dma,
res->start = dma; res->start = dma;
res->end = dma; res->end = dma;
pnp_dbg(&dev->dev, " add dma %d flags %#x\n", dma, flags); pnp_dbg(&dev->dev, " add %pRf\n", res);
return pnp_res; return pnp_res;
} }
...@@ -562,8 +562,7 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev, ...@@ -562,8 +562,7 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev,
res->start = start; res->start = start;
res->end = end; res->end = end;
pnp_dbg(&dev->dev, " add io %#llx-%#llx flags %#x\n", pnp_dbg(&dev->dev, " add %pRf\n", res);
(unsigned long long) start, (unsigned long long) end, flags);
return pnp_res; return pnp_res;
} }
...@@ -587,8 +586,7 @@ struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, ...@@ -587,8 +586,7 @@ struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev,
res->start = start; res->start = start;
res->end = end; res->end = end;
pnp_dbg(&dev->dev, " add mem %#llx-%#llx flags %#x\n", pnp_dbg(&dev->dev, " add %pRf\n", res);
(unsigned long long) start, (unsigned long long) end, flags);
return pnp_res; return pnp_res;
} }
......
...@@ -75,47 +75,14 @@ char *pnp_resource_type_name(struct resource *res) ...@@ -75,47 +75,14 @@ char *pnp_resource_type_name(struct resource *res)
void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc) void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
{ {
char buf[128];
int len;
struct pnp_resource *pnp_res; struct pnp_resource *pnp_res;
struct resource *res;
if (list_empty(&dev->resources)) { if (list_empty(&dev->resources))
pnp_dbg(&dev->dev, "%s: no current resources\n", desc); pnp_dbg(&dev->dev, "%s: no current resources\n", desc);
return; else {
}
pnp_dbg(&dev->dev, "%s: current resources:\n", desc); pnp_dbg(&dev->dev, "%s: current resources:\n", desc);
list_for_each_entry(pnp_res, &dev->resources, list) { list_for_each_entry(pnp_res, &dev->resources, list)
res = &pnp_res->res; pnp_dbg(&dev->dev, "%pRf\n", &pnp_res->res);
len = 0;
len += scnprintf(buf + len, sizeof(buf) - len, " %-3s ",
pnp_resource_type_name(res));
if (res->flags & IORESOURCE_DISABLED) {
pnp_dbg(&dev->dev, "%sdisabled\n", buf);
continue;
}
switch (pnp_resource_type(res)) {
case IORESOURCE_IO:
case IORESOURCE_MEM:
len += scnprintf(buf + len, sizeof(buf) - len,
"%#llx-%#llx flags %#lx",
(unsigned long long) res->start,
(unsigned long long) res->end,
res->flags);
break;
case IORESOURCE_IRQ:
case IORESOURCE_DMA:
len += scnprintf(buf + len, sizeof(buf) - len,
"%lld flags %#lx",
(unsigned long long) res->start,
res->flags);
break;
}
pnp_dbg(&dev->dev, "%s\n", buf);
} }
} }
......
...@@ -22,11 +22,11 @@ static const struct pnp_device_id pnp_dev_table[] = { ...@@ -22,11 +22,11 @@ static const struct pnp_device_id pnp_dev_table[] = {
{"", 0} {"", 0}
}; };
static void reserve_range(struct pnp_dev *dev, resource_size_t start, static void reserve_range(struct pnp_dev *dev, struct resource *r, int port)
resource_size_t end, int port)
{ {
char *regionid; char *regionid;
const char *pnpid = dev_name(&dev->dev); const char *pnpid = dev_name(&dev->dev);
resource_size_t start = r->start, end = r->end;
struct resource *res; struct resource *res;
regionid = kmalloc(16, GFP_KERNEL); regionid = kmalloc(16, GFP_KERNEL);
...@@ -48,9 +48,7 @@ static void reserve_range(struct pnp_dev *dev, resource_size_t start, ...@@ -48,9 +48,7 @@ static void reserve_range(struct pnp_dev *dev, resource_size_t start,
* example do reserve stuff they know about too, so we may well * example do reserve stuff they know about too, so we may well
* have double reservations. * have double reservations.
*/ */
dev_info(&dev->dev, "%s range 0x%llx-0x%llx %s reserved\n", dev_info(&dev->dev, "%pRt %s reserved\n", r,
port ? "ioport" : "iomem",
(unsigned long long) start, (unsigned long long) end,
res ? "has been" : "could not be"); res ? "has been" : "could not be");
} }
...@@ -77,14 +75,14 @@ static void reserve_resources_of_dev(struct pnp_dev *dev) ...@@ -77,14 +75,14 @@ static void reserve_resources_of_dev(struct pnp_dev *dev)
if (res->end < res->start) if (res->end < res->start)
continue; /* invalid */ continue; /* invalid */
reserve_range(dev, res->start, res->end, 1); reserve_range(dev, res, 1);
} }
for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) { for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) {
if (res->flags & IORESOURCE_DISABLED) if (res->flags & IORESOURCE_DISABLED)
continue; continue;
reserve_range(dev, res->start, res->end, 0); reserve_range(dev, res, 0);
} }
} }
......
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