aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2007-10-17 02:31:10 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:43:04 -0400
commita05d0781695566296e74a3670dd5bbd3daf24ae2 (patch)
tree56a474e1011187cd1cdee542dcfa253d64e4a53c /drivers
parent5bfc43a0b65a11ca1e9edfa0c2bd34ce43da0346 (diff)
PNP: use dev_info(), dev_err(), etc in core
If we have the struct pnp_dev available, we can use dev_info(), dev_err(), etc., to give a little more information and consistency. [akpm@linux-foundation.org: fix warning] Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: Adam Belay <ambx1@neo.rr.com> Cc: Len Brown <lenb@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pnp/Makefile4
-rw-r--r--drivers/pnp/card.c3
-rw-r--r--drivers/pnp/driver.c5
-rw-r--r--drivers/pnp/interface.c3
-rw-r--r--drivers/pnp/manager.c31
-rw-r--r--drivers/pnp/quirks.c12
-rw-r--r--drivers/pnp/resource.c2
7 files changed, 31 insertions, 29 deletions
diff --git a/drivers/pnp/Makefile b/drivers/pnp/Makefile
index a381a92fd1b6..26f5abc9c3f7 100644
--- a/drivers/pnp/Makefile
+++ b/drivers/pnp/Makefile
@@ -7,3 +7,7 @@ obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quir
7obj-$(CONFIG_PNPACPI) += pnpacpi/ 7obj-$(CONFIG_PNPACPI) += pnpacpi/
8obj-$(CONFIG_PNPBIOS) += pnpbios/ 8obj-$(CONFIG_PNPBIOS) += pnpbios/
9obj-$(CONFIG_ISAPNP) += isapnp/ 9obj-$(CONFIG_ISAPNP) += isapnp/
10
11ifeq ($(CONFIG_PNP_DEBUG),y)
12EXTRA_CFLAGS += -DDEBUG
13endif
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index 3b48aef8f4eb..da1c9909eb44 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -198,8 +198,7 @@ int pnp_add_card(struct pnp_card *card)
198 card->dev.release = &pnp_release_card; 198 card->dev.release = &pnp_release_card;
199 error = device_register(&card->dev); 199 error = device_register(&card->dev);
200 if (error) { 200 if (error) {
201 pnp_err("sysfs failure, card '%s' will be unavailable", 201 dev_err(&card->dev, "could not register (err=%d)\n", error);
202 card->dev.bus_id);
203 return error; 202 return error;
204 } 203 }
205 204
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 2fa64a6b25c8..a262762c5b88 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -86,9 +86,6 @@ static int pnp_device_probe(struct device *dev)
86 pnp_dev = to_pnp_dev(dev); 86 pnp_dev = to_pnp_dev(dev);
87 pnp_drv = to_pnp_driver(dev->driver); 87 pnp_drv = to_pnp_driver(dev->driver);
88 88
89 pnp_dbg("match found with the PnP device '%s' and the driver '%s'",
90 dev->bus_id, pnp_drv->name);
91
92 error = pnp_device_attach(pnp_dev); 89 error = pnp_device_attach(pnp_dev);
93 if (error < 0) 90 if (error < 0)
94 return error; 91 return error;
@@ -116,6 +113,8 @@ static int pnp_device_probe(struct device *dev)
116 error = 0; 113 error = 0;
117 } else 114 } else
118 goto fail; 115 goto fail;
116
117 dev_dbg(dev, "driver attached\n");
119 return error; 118 return error;
120 119
121fail: 120fail:
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index e0ee28a88da3..31548044fdde 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -327,8 +327,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
327 327
328 if (dev->status & PNP_ATTACHED) { 328 if (dev->status & PNP_ATTACHED) {
329 retval = -EBUSY; 329 retval = -EBUSY;
330 pnp_info("Device %s cannot be configured because it is in use.", 330 dev_info(&dev->dev, "in use; can't configure\n");
331 dev->dev.bus_id);
332 goto done; 331 goto done;
333 } 332 }
334 333
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index 5e43c4719099..c6b3d4e63ccc 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -22,8 +22,7 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
22 unsigned long *flags; 22 unsigned long *flags;
23 23
24 if (idx >= PNP_MAX_PORT) { 24 if (idx >= PNP_MAX_PORT) {
25 pnp_err 25 dev_err(&dev->dev, "too many I/O port resources\n");
26 ("More than 4 ports is incompatible with pnp specifications.");
27 /* pretend we were successful so at least the manager won't try again */ 26 /* pretend we were successful so at least the manager won't try again */
28 return 1; 27 return 1;
29 } 28 }
@@ -64,8 +63,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
64 unsigned long *flags; 63 unsigned long *flags;
65 64
66 if (idx >= PNP_MAX_MEM) { 65 if (idx >= PNP_MAX_MEM) {
67 pnp_err 66 dev_err(&dev->dev, "too many memory resources\n");
68 ("More than 8 mems is incompatible with pnp specifications.");
69 /* pretend we were successful so at least the manager won't try again */ 67 /* pretend we were successful so at least the manager won't try again */
70 return 1; 68 return 1;
71 } 69 }
@@ -122,8 +120,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
122 }; 120 };
123 121
124 if (idx >= PNP_MAX_IRQ) { 122 if (idx >= PNP_MAX_IRQ) {
125 pnp_err 123 dev_err(&dev->dev, "too many IRQ resources\n");
126 ("More than 2 irqs is incompatible with pnp specifications.");
127 /* pretend we were successful so at least the manager won't try again */ 124 /* pretend we were successful so at least the manager won't try again */
128 return 1; 125 return 1;
129 } 126 }
@@ -173,8 +170,7 @@ static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
173 }; 170 };
174 171
175 if (idx >= PNP_MAX_DMA) { 172 if (idx >= PNP_MAX_DMA) {
176 pnp_err("More than 2 dmas is incompatible with pnp " 173 dev_err(&dev->dev, "too many DMA resources\n");
177 "specifications.");
178 return; 174 return;
179 } 175 }
180 176
@@ -442,8 +438,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
442 int i = 1; 438 int i = 1;
443 439
444 if (!pnp_can_configure(dev)) { 440 if (!pnp_can_configure(dev)) {
445 pnp_dbg("Device %s does not support resource configuration.", 441 dev_dbg(&dev->dev, "configuration not supported\n");
446 dev->dev.bus_id);
447 return -ENODEV; 442 return -ENODEV;
448 } 443 }
449 444
@@ -460,7 +455,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
460 } while (dep); 455 } while (dep);
461 } 456 }
462 457
463 pnp_err("Unable to assign resources to device %s.", dev->dev.bus_id); 458 dev_err(&dev->dev, "unable to assign resources\n");
464 return -EBUSY; 459 return -EBUSY;
465} 460}
466 461
@@ -473,17 +468,16 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
473int pnp_start_dev(struct pnp_dev *dev) 468int pnp_start_dev(struct pnp_dev *dev)
474{ 469{
475 if (!pnp_can_write(dev)) { 470 if (!pnp_can_write(dev)) {
476 pnp_dbg("Device %s does not support activation.", 471 dev_dbg(&dev->dev, "activation not supported\n");
477 dev->dev.bus_id);
478 return -EINVAL; 472 return -EINVAL;
479 } 473 }
480 474
481 if (dev->protocol->set(dev, &dev->res) < 0) { 475 if (dev->protocol->set(dev, &dev->res) < 0) {
482 pnp_err("Failed to activate device %s.", dev->dev.bus_id); 476 dev_err(&dev->dev, "activation failed\n");
483 return -EIO; 477 return -EIO;
484 } 478 }
485 479
486 pnp_info("Device %s activated.", dev->dev.bus_id); 480 dev_info(&dev->dev, "activated\n");
487 return 0; 481 return 0;
488} 482}
489 483
@@ -496,16 +490,15 @@ int pnp_start_dev(struct pnp_dev *dev)
496int pnp_stop_dev(struct pnp_dev *dev) 490int pnp_stop_dev(struct pnp_dev *dev)
497{ 491{
498 if (!pnp_can_disable(dev)) { 492 if (!pnp_can_disable(dev)) {
499 pnp_dbg("Device %s does not support disabling.", 493 dev_dbg(&dev->dev, "disabling not supported\n");
500 dev->dev.bus_id);
501 return -EINVAL; 494 return -EINVAL;
502 } 495 }
503 if (dev->protocol->disable(dev) < 0) { 496 if (dev->protocol->disable(dev) < 0) {
504 pnp_err("Failed to disable device %s.", dev->dev.bus_id); 497 dev_err(&dev->dev, "disable failed\n");
505 return -EIO; 498 return -EIO;
506 } 499 }
507 500
508 pnp_info("Device %s disabled.", dev->dev.bus_id); 501 dev_info(&dev->dev, "disabled\n");
509 return 0; 502 return 0;
510} 503}
511 504
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 6b0cf0c2a088..e903b8c2b1fa 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -17,6 +17,7 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/pnp.h> 18#include <linux/pnp.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/kallsyms.h>
20#include "base.h" 21#include "base.h"
21 22
22static void quirk_awe32_resources(struct pnp_dev *dev) 23static void quirk_awe32_resources(struct pnp_dev *dev)
@@ -133,11 +134,18 @@ static struct pnp_fixup pnp_fixups[] = {
133void pnp_fixup_device(struct pnp_dev *dev) 134void pnp_fixup_device(struct pnp_dev *dev)
134{ 135{
135 int i = 0; 136 int i = 0;
137 void (*quirk)(struct pnp_dev *);
136 138
137 while (*pnp_fixups[i].id) { 139 while (*pnp_fixups[i].id) {
138 if (compare_pnp_id(dev->id, pnp_fixups[i].id)) { 140 if (compare_pnp_id(dev->id, pnp_fixups[i].id)) {
139 pnp_dbg("Calling quirk for %s", dev->dev.bus_id); 141 quirk = pnp_fixups[i].quirk_function;
140 pnp_fixups[i].quirk_function(dev); 142
143#ifdef DEBUG
144 dev_dbg(&dev->dev, "calling quirk 0x%p", quirk);
145 print_fn_descriptor_symbol(": %s()\n",
146 (unsigned long) *quirk);
147#endif
148 (*quirk)(dev);
141 } 149 }
142 i++; 150 i++;
143 } 151 }
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 087fed18628f..41d73a5e9312 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -51,7 +51,7 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
51 51
52 /* this should never happen but if it does we'll try to continue */ 52 /* this should never happen but if it does we'll try to continue */
53 if (dev->independent) 53 if (dev->independent)
54 pnp_err("independent resource already registered"); 54 dev_err(&dev->dev, "independent resource already registered\n");
55 dev->independent = option; 55 dev->independent = option;
56 return option; 56 return option;
57} 57}