aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-10-06 17:34:00 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-04 11:47:20 -0500
commit9a007b3791cdba3601d835ea10e68c14115b9afb (patch)
tree37b36bcacaf04a88cb19d28c9e811e5569a25e2c /drivers
parent637b363e86f71effe74cba5d509f18bd3199a65b (diff)
PNP: print resources consistently with %pRt
This uses %pRt and %pRf to print additional resource information (type, size, prefetchability, etc.) consistently. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pnp/quirks.c12
-rw-r--r--drivers/pnp/resource.c10
-rw-r--r--drivers/pnp/support.c43
-rw-r--r--drivers/pnp/system.c14
4 files changed, 18 insertions, 61 deletions
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 8473fe5ed7ff..3a2031b25c3c 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -285,15 +285,9 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
285 * the PCI region, and that might prevent a PCI 285 * the PCI region, and that might prevent a PCI
286 * driver from requesting its resources. 286 * driver from requesting its resources.
287 */ 287 */
288 dev_warn(&dev->dev, "%s resource " 288 dev_warn(&dev->dev, "resource %pRt overlaps %s "
289 "(0x%llx-0x%llx) overlaps %s BAR %d " 289 "BAR %d %pRt, disabling\n", res,
290 "(0x%llx-0x%llx), disabling\n", 290 pci_name(pdev), i, &pdev->resource[i]);
291 pnp_resource_type_name(res),
292 (unsigned long long) pnp_start,
293 (unsigned long long) pnp_end,
294 pci_name(pdev), i,
295 (unsigned long long) pci_start,
296 (unsigned long long) pci_end);
297 res->flags |= IORESOURCE_DISABLED; 291 res->flags |= IORESOURCE_DISABLED;
298 } 292 }
299 } 293 }
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index ba9765427886..18557d7bb0b9 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -517,7 +517,7 @@ struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq,
517 res->start = irq; 517 res->start = irq;
518 res->end = irq; 518 res->end = irq;
519 519
520 pnp_dbg(&dev->dev, " add irq %d flags %#x\n", irq, flags); 520 pnp_dbg(&dev->dev, " add %pRf\n", res);
521 return pnp_res; 521 return pnp_res;
522} 522}
523 523
@@ -538,7 +538,7 @@ struct pnp_resource *pnp_add_dma_resource(struct pnp_dev *dev, int dma,
538 res->start = dma; 538 res->start = dma;
539 res->end = dma; 539 res->end = dma;
540 540
541 pnp_dbg(&dev->dev, " add dma %d flags %#x\n", dma, flags); 541 pnp_dbg(&dev->dev, " add %pRf\n", res);
542 return pnp_res; 542 return pnp_res;
543} 543}
544 544
@@ -562,8 +562,7 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev,
562 res->start = start; 562 res->start = start;
563 res->end = end; 563 res->end = end;
564 564
565 pnp_dbg(&dev->dev, " add io %#llx-%#llx flags %#x\n", 565 pnp_dbg(&dev->dev, " add %pRf\n", res);
566 (unsigned long long) start, (unsigned long long) end, flags);
567 return pnp_res; 566 return pnp_res;
568} 567}
569 568
@@ -587,8 +586,7 @@ struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev,
587 res->start = start; 586 res->start = start;
588 res->end = end; 587 res->end = end;
589 588
590 pnp_dbg(&dev->dev, " add mem %#llx-%#llx flags %#x\n", 589 pnp_dbg(&dev->dev, " add %pRf\n", res);
591 (unsigned long long) start, (unsigned long long) end, flags);
592 return pnp_res; 590 return pnp_res;
593} 591}
594 592
diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c
index 63087d5ce609..1f8a33b0abac 100644
--- a/drivers/pnp/support.c
+++ b/drivers/pnp/support.c
@@ -75,47 +75,14 @@ char *pnp_resource_type_name(struct resource *res)
75 75
76void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc) 76void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
77{ 77{
78 char buf[128];
79 int len;
80 struct pnp_resource *pnp_res; 78 struct pnp_resource *pnp_res;
81 struct resource *res;
82 79
83 if (list_empty(&dev->resources)) { 80 if (list_empty(&dev->resources))
84 pnp_dbg(&dev->dev, "%s: no current resources\n", desc); 81 pnp_dbg(&dev->dev, "%s: no current resources\n", desc);
85 return; 82 else {
86 } 83 pnp_dbg(&dev->dev, "%s: current resources:\n", desc);
87 84 list_for_each_entry(pnp_res, &dev->resources, list)
88 pnp_dbg(&dev->dev, "%s: current resources:\n", desc); 85 pnp_dbg(&dev->dev, "%pRf\n", &pnp_res->res);
89 list_for_each_entry(pnp_res, &dev->resources, list) {
90 res = &pnp_res->res;
91 len = 0;
92
93 len += scnprintf(buf + len, sizeof(buf) - len, " %-3s ",
94 pnp_resource_type_name(res));
95
96 if (res->flags & IORESOURCE_DISABLED) {
97 pnp_dbg(&dev->dev, "%sdisabled\n", buf);
98 continue;
99 }
100
101 switch (pnp_resource_type(res)) {
102 case IORESOURCE_IO:
103 case IORESOURCE_MEM:
104 len += scnprintf(buf + len, sizeof(buf) - len,
105 "%#llx-%#llx flags %#lx",
106 (unsigned long long) res->start,
107 (unsigned long long) res->end,
108 res->flags);
109 break;
110 case IORESOURCE_IRQ:
111 case IORESOURCE_DMA:
112 len += scnprintf(buf + len, sizeof(buf) - len,
113 "%lld flags %#lx",
114 (unsigned long long) res->start,
115 res->flags);
116 break;
117 }
118 pnp_dbg(&dev->dev, "%s\n", buf);
119 } 86 }
120} 87}
121 88
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c
index 59b90922da8c..242d3a872011 100644
--- a/drivers/pnp/system.c
+++ b/drivers/pnp/system.c
@@ -22,11 +22,11 @@ static const struct pnp_device_id pnp_dev_table[] = {
22 {"", 0} 22 {"", 0}
23}; 23};
24 24
25static void reserve_range(struct pnp_dev *dev, resource_size_t start, 25static void reserve_range(struct pnp_dev *dev, struct resource *r, int port)
26 resource_size_t end, int port)
27{ 26{
28 char *regionid; 27 char *regionid;
29 const char *pnpid = dev_name(&dev->dev); 28 const char *pnpid = dev_name(&dev->dev);
29 resource_size_t start = r->start, end = r->end;
30 struct resource *res; 30 struct resource *res;
31 31
32 regionid = kmalloc(16, GFP_KERNEL); 32 regionid = kmalloc(16, GFP_KERNEL);
@@ -48,10 +48,8 @@ static void reserve_range(struct pnp_dev *dev, resource_size_t start,
48 * example do reserve stuff they know about too, so we may well 48 * example do reserve stuff they know about too, so we may well
49 * have double reservations. 49 * have double reservations.
50 */ 50 */
51 dev_info(&dev->dev, "%s range 0x%llx-0x%llx %s reserved\n", 51 dev_info(&dev->dev, "%pRt %s reserved\n", r,
52 port ? "ioport" : "iomem", 52 res ? "has been" : "could not be");
53 (unsigned long long) start, (unsigned long long) end,
54 res ? "has been" : "could not be");
55} 53}
56 54
57static void reserve_resources_of_dev(struct pnp_dev *dev) 55static void reserve_resources_of_dev(struct pnp_dev *dev)
@@ -77,14 +75,14 @@ static void reserve_resources_of_dev(struct pnp_dev *dev)
77 if (res->end < res->start) 75 if (res->end < res->start)
78 continue; /* invalid */ 76 continue; /* invalid */
79 77
80 reserve_range(dev, res->start, res->end, 1); 78 reserve_range(dev, res, 1);
81 } 79 }
82 80
83 for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) { 81 for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) {
84 if (res->flags & IORESOURCE_DISABLED) 82 if (res->flags & IORESOURCE_DISABLED)
85 continue; 83 continue;
86 84
87 reserve_range(dev, res->start, res->end, 0); 85 reserve_range(dev, res, 0);
88 } 86 }
89} 87}
90 88