]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pnp/core.c
leds: hw acceleration for Clevo mail LED driver
[linux-2.6-omap-h63xx.git] / drivers / pnp / core.c
index 61066fdb9e6ddac8237281cfaecb81d55dc246d3..7d366ca672d34ea7b6d07afa04fbcfbec849ad10 100644 (file)
@@ -52,9 +52,6 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
        int nodenum;
        struct list_head *pos;
 
-       if (!protocol)
-               return -EINVAL;
-
        INIT_LIST_HEAD(&protocol->devices);
        INIT_LIST_HEAD(&protocol->cards);
        nodenum = 0;
@@ -94,8 +91,6 @@ static void pnp_free_ids(struct pnp_dev *dev)
        struct pnp_id *id;
        struct pnp_id *next;
 
-       if (!dev)
-               return;
        id = dev->id;
        while (id) {
                next = id->next;
@@ -130,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;
 }
 
 /*
@@ -143,12 +140,30 @@ int __pnp_add_device(struct pnp_dev *dev)
  */
 int pnp_add_device(struct pnp_dev *dev)
 {
-       if (!dev || !dev->protocol || dev->card)
+       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)