From 348366b963e4e1462c8354827a9cb910aa865bf2 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Tue, 16 Oct 2007 23:31:12 -0700 Subject: PNP: add debug message for adding new device Add PNP debug message when adding a device, remove similar PNPACPI message with less information. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Len Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/pnp/core.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'drivers/pnp/core.c') diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c index d5964feb14de..7d366ca672d3 100644 --- a/drivers/pnp/core.c +++ b/drivers/pnp/core.c @@ -125,9 +125,11 @@ int __pnp_add_device(struct pnp_dev *dev) spin_unlock(&pnp_lock); ret = device_register(&dev->dev); - if (ret == 0) - pnp_interface_attach_device(dev); - return ret; + if (ret) + return ret; + + pnp_interface_attach_device(dev); + return 0; } /* @@ -138,12 +140,30 @@ int __pnp_add_device(struct pnp_dev *dev) */ int pnp_add_device(struct pnp_dev *dev) { + int ret; + if (dev->card) return -EINVAL; + dev->dev.parent = &dev->protocol->dev; sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, dev->number); - return __pnp_add_device(dev); + ret = __pnp_add_device(dev); + if (ret) + return ret; + +#ifdef CONFIG_PNP_DEBUG + { + struct pnp_id *id; + + dev_printk(KERN_DEBUG, &dev->dev, "%s device, IDs", + dev->protocol->name); + for (id = dev->id; id; id = id->next) + printk(" %s", id->id); + printk(" (%s)\n", dev->active ? "active" : "disabled"); + } +#endif + return 0; } void __pnp_remove_device(struct pnp_dev *dev) -- cgit v1.2.3-58-ga151