提交 a05d0781 编写于 作者: B Bjorn Helgaas 提交者: Linus Torvalds

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: NBjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 5bfc43a0
...@@ -7,3 +7,7 @@ obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quir ...@@ -7,3 +7,7 @@ obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quir
obj-$(CONFIG_PNPACPI) += pnpacpi/ obj-$(CONFIG_PNPACPI) += pnpacpi/
obj-$(CONFIG_PNPBIOS) += pnpbios/ obj-$(CONFIG_PNPBIOS) += pnpbios/
obj-$(CONFIG_ISAPNP) += isapnp/ obj-$(CONFIG_ISAPNP) += isapnp/
ifeq ($(CONFIG_PNP_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG
endif
...@@ -198,8 +198,7 @@ int pnp_add_card(struct pnp_card *card) ...@@ -198,8 +198,7 @@ int pnp_add_card(struct pnp_card *card)
card->dev.release = &pnp_release_card; card->dev.release = &pnp_release_card;
error = device_register(&card->dev); error = device_register(&card->dev);
if (error) { if (error) {
pnp_err("sysfs failure, card '%s' will be unavailable", dev_err(&card->dev, "could not register (err=%d)\n", error);
card->dev.bus_id);
return error; return error;
} }
......
...@@ -86,9 +86,6 @@ static int pnp_device_probe(struct device *dev) ...@@ -86,9 +86,6 @@ static int pnp_device_probe(struct device *dev)
pnp_dev = to_pnp_dev(dev); pnp_dev = to_pnp_dev(dev);
pnp_drv = to_pnp_driver(dev->driver); pnp_drv = to_pnp_driver(dev->driver);
pnp_dbg("match found with the PnP device '%s' and the driver '%s'",
dev->bus_id, pnp_drv->name);
error = pnp_device_attach(pnp_dev); error = pnp_device_attach(pnp_dev);
if (error < 0) if (error < 0)
return error; return error;
...@@ -116,6 +113,8 @@ static int pnp_device_probe(struct device *dev) ...@@ -116,6 +113,8 @@ static int pnp_device_probe(struct device *dev)
error = 0; error = 0;
} else } else
goto fail; goto fail;
dev_dbg(dev, "driver attached\n");
return error; return error;
fail: fail:
......
...@@ -327,8 +327,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, ...@@ -327,8 +327,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
if (dev->status & PNP_ATTACHED) { if (dev->status & PNP_ATTACHED) {
retval = -EBUSY; retval = -EBUSY;
pnp_info("Device %s cannot be configured because it is in use.", dev_info(&dev->dev, "in use; can't configure\n");
dev->dev.bus_id);
goto done; goto done;
} }
......
...@@ -22,8 +22,7 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx) ...@@ -22,8 +22,7 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
unsigned long *flags; unsigned long *flags;
if (idx >= PNP_MAX_PORT) { if (idx >= PNP_MAX_PORT) {
pnp_err dev_err(&dev->dev, "too many I/O port resources\n");
("More than 4 ports is incompatible with pnp specifications.");
/* pretend we were successful so at least the manager won't try again */ /* pretend we were successful so at least the manager won't try again */
return 1; return 1;
} }
...@@ -64,8 +63,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) ...@@ -64,8 +63,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
unsigned long *flags; unsigned long *flags;
if (idx >= PNP_MAX_MEM) { if (idx >= PNP_MAX_MEM) {
pnp_err dev_err(&dev->dev, "too many memory resources\n");
("More than 8 mems is incompatible with pnp specifications.");
/* pretend we were successful so at least the manager won't try again */ /* pretend we were successful so at least the manager won't try again */
return 1; return 1;
} }
...@@ -122,8 +120,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx) ...@@ -122,8 +120,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
}; };
if (idx >= PNP_MAX_IRQ) { if (idx >= PNP_MAX_IRQ) {
pnp_err dev_err(&dev->dev, "too many IRQ resources\n");
("More than 2 irqs is incompatible with pnp specifications.");
/* pretend we were successful so at least the manager won't try again */ /* pretend we were successful so at least the manager won't try again */
return 1; return 1;
} }
...@@ -173,8 +170,7 @@ static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) ...@@ -173,8 +170,7 @@ static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
}; };
if (idx >= PNP_MAX_DMA) { if (idx >= PNP_MAX_DMA) {
pnp_err("More than 2 dmas is incompatible with pnp " dev_err(&dev->dev, "too many DMA resources\n");
"specifications.");
return; return;
} }
...@@ -442,8 +438,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev) ...@@ -442,8 +438,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
int i = 1; int i = 1;
if (!pnp_can_configure(dev)) { if (!pnp_can_configure(dev)) {
pnp_dbg("Device %s does not support resource configuration.", dev_dbg(&dev->dev, "configuration not supported\n");
dev->dev.bus_id);
return -ENODEV; return -ENODEV;
} }
...@@ -460,7 +455,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev) ...@@ -460,7 +455,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
} while (dep); } while (dep);
} }
pnp_err("Unable to assign resources to device %s.", dev->dev.bus_id); dev_err(&dev->dev, "unable to assign resources\n");
return -EBUSY; return -EBUSY;
} }
...@@ -473,17 +468,16 @@ int pnp_auto_config_dev(struct pnp_dev *dev) ...@@ -473,17 +468,16 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
int pnp_start_dev(struct pnp_dev *dev) int pnp_start_dev(struct pnp_dev *dev)
{ {
if (!pnp_can_write(dev)) { if (!pnp_can_write(dev)) {
pnp_dbg("Device %s does not support activation.", dev_dbg(&dev->dev, "activation not supported\n");
dev->dev.bus_id);
return -EINVAL; return -EINVAL;
} }
if (dev->protocol->set(dev, &dev->res) < 0) { if (dev->protocol->set(dev, &dev->res) < 0) {
pnp_err("Failed to activate device %s.", dev->dev.bus_id); dev_err(&dev->dev, "activation failed\n");
return -EIO; return -EIO;
} }
pnp_info("Device %s activated.", dev->dev.bus_id); dev_info(&dev->dev, "activated\n");
return 0; return 0;
} }
...@@ -496,16 +490,15 @@ int pnp_start_dev(struct pnp_dev *dev) ...@@ -496,16 +490,15 @@ int pnp_start_dev(struct pnp_dev *dev)
int pnp_stop_dev(struct pnp_dev *dev) int pnp_stop_dev(struct pnp_dev *dev)
{ {
if (!pnp_can_disable(dev)) { if (!pnp_can_disable(dev)) {
pnp_dbg("Device %s does not support disabling.", dev_dbg(&dev->dev, "disabling not supported\n");
dev->dev.bus_id);
return -EINVAL; return -EINVAL;
} }
if (dev->protocol->disable(dev) < 0) { if (dev->protocol->disable(dev) < 0) {
pnp_err("Failed to disable device %s.", dev->dev.bus_id); dev_err(&dev->dev, "disable failed\n");
return -EIO; return -EIO;
} }
pnp_info("Device %s disabled.", dev->dev.bus_id); dev_info(&dev->dev, "disabled\n");
return 0; return 0;
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/pnp.h> #include <linux/pnp.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/kallsyms.h>
#include "base.h" #include "base.h"
static void quirk_awe32_resources(struct pnp_dev *dev) static void quirk_awe32_resources(struct pnp_dev *dev)
...@@ -133,11 +134,18 @@ static struct pnp_fixup pnp_fixups[] = { ...@@ -133,11 +134,18 @@ static struct pnp_fixup pnp_fixups[] = {
void pnp_fixup_device(struct pnp_dev *dev) void pnp_fixup_device(struct pnp_dev *dev)
{ {
int i = 0; int i = 0;
void (*quirk)(struct pnp_dev *);
while (*pnp_fixups[i].id) { while (*pnp_fixups[i].id) {
if (compare_pnp_id(dev->id, pnp_fixups[i].id)) { if (compare_pnp_id(dev->id, pnp_fixups[i].id)) {
pnp_dbg("Calling quirk for %s", dev->dev.bus_id); quirk = pnp_fixups[i].quirk_function;
pnp_fixups[i].quirk_function(dev);
#ifdef DEBUG
dev_dbg(&dev->dev, "calling quirk 0x%p", quirk);
print_fn_descriptor_symbol(": %s()\n",
(unsigned long) *quirk);
#endif
(*quirk)(dev);
} }
i++; i++;
} }
......
...@@ -51,7 +51,7 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) ...@@ -51,7 +51,7 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
/* this should never happen but if it does we'll try to continue */ /* this should never happen but if it does we'll try to continue */
if (dev->independent) if (dev->independent)
pnp_err("independent resource already registered"); dev_err(&dev->dev, "independent resource already registered\n");
dev->independent = option; dev->independent = option;
return option; return option;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册