]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pnp/pnpbios/core.c
Merge branches 'release' and 'stats' into release
[linux-2.6-omap-h63xx.git] / drivers / pnp / pnpbios / core.c
index 3692a099b45f63f96d834055751bc94f9594f27c..f7e67197a56847c9d937ab0cb2efd595ee3fc306 100644 (file)
@@ -315,25 +315,31 @@ struct pnp_protocol pnpbios_protocol = {
        .disable = pnpbios_disable_resources,
 };
 
-static int insert_device(struct pnp_dev *dev, struct pnp_bios_node *node)
+static int __init insert_device(struct pnp_bios_node *node)
 {
        struct list_head *pos;
-       struct pnp_dev *pnp_dev;
+       struct pnp_dev *dev;
        struct pnp_id *dev_id;
        char id[8];
 
        /* check if the device is already added */
-       dev->number = node->handle;
        list_for_each(pos, &pnpbios_protocol.devices) {
-               pnp_dev = list_entry(pos, struct pnp_dev, protocol_list);
-               if (dev->number == pnp_dev->number)
+               dev = list_entry(pos, struct pnp_dev, protocol_list);
+               if (dev->number == node->handle)
                        return -1;
        }
 
-       /* set the initial values for the PnP device */
+       dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
+       if (!dev)
+               return -1;
+
        dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
-       if (!dev_id)
+       if (!dev_id) {
+               kfree(dev);
                return -1;
+       }
+
+       dev->number = node->handle;
        pnpid32_to_pnpid(node->eisa_id, id);
        memcpy(dev_id->id, id, 7);
        pnp_add_id(dev_id, dev);
@@ -367,7 +373,6 @@ static void __init build_devlist(void)
        unsigned int nodes_got = 0;
        unsigned int devs = 0;
        struct pnp_bios_node *node;
-       struct pnp_dev *dev;
 
        node = kzalloc(node_info.max_node_size, GFP_KERNEL);
        if (!node)
@@ -388,12 +393,7 @@ static void __init build_devlist(void)
                                break;
                }
                nodes_got++;
-               dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
-               if (!dev)
-                       break;
-               if (insert_device(dev, node) < 0)
-                       kfree(dev);
-               else
+               if (insert_device(node) == 0)
                        devs++;
                if (nodenum <= thisnodenum) {
                        printk(KERN_ERR
@@ -419,7 +419,6 @@ static void __init build_devlist(void)
 static int pnpbios_disabled;
 int pnpbios_dont_use_current_config;
 
-#ifndef MODULE
 static int __init pnpbios_setup(char *str)
 {
        int invert;
@@ -443,7 +442,6 @@ static int __init pnpbios_setup(char *str)
 }
 
 __setup("pnpbios=", pnpbios_setup);
-#endif
 
 /* PnP BIOS signature: "$PnP" */
 #define PNP_SIGNATURE   (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24))
@@ -502,7 +500,7 @@ static int __init pnpbios_probe_system(void)
        return 0;
 }
 
-static int __init exploding_pnp_bios(struct dmi_system_id *d)
+static int __init exploding_pnp_bios(const struct dmi_system_id *d)
 {
        printk(KERN_WARNING "%s detected. Disabling PnPBIOS\n", d->ident);
        return 0;
@@ -591,6 +589,7 @@ subsys_initcall(pnpbios_init);
 static int __init pnpbios_thread_init(void)
 {
        struct task_struct *task;
+
 #if defined(CONFIG_PPC_MERGE)
        if (check_legacy_ioport(PNPBIOS_BASE))
                return 0;
@@ -606,48 +605,7 @@ static int __init pnpbios_thread_init(void)
        return 0;
 }
 
-#ifndef MODULE
-
-/* init/main.c calls pnpbios_init early */
-
 /* Start the kernel thread later: */
 module_init(pnpbios_thread_init);
 
-#else
-
-/*
- * N.B.: Building pnpbios as a module hasn't been fully implemented
- */
-
-MODULE_LICENSE("GPL");
-
-static int __init pnpbios_init_all(void)
-{
-       int r;
-
-       r = pnpbios_init();
-       if (r)
-               return r;
-       r = pnpbios_thread_init();
-       if (r)
-               return r;
-       return 0;
-}
-
-static void __exit pnpbios_exit(void)
-{
-#ifdef CONFIG_HOTPLUG
-       unloading = 1;
-       wait_for_completion(&unload_sem);
-#endif
-       pnpbios_proc_exit();
-       /* We ought to free resources here */
-       return;
-}
-
-module_init(pnpbios_init_all);
-module_exit(pnpbios_exit);
-
-#endif
-
 EXPORT_SYMBOL(pnpbios_protocol);