pcmcia: blackfin: fix bug - add missing ; to MODULE macro
[safe/jmp/linux-2.6] / drivers / pcmcia / pxa2xx_sharpsl.c
index 12a7244..1cd02f5 100644 (file)
 #include <linux/platform_device.h>
 
 #include <asm/mach-types.h>
-#include <asm/hardware.h>
+#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/hardware/scoop.h>
 
 #include "soc_common.h"
 
 #define        NO_KEEP_VS 0x0001
-
-/* PCMCIA to Scoop linkage
-
-   There is no easy way to link multiple scoop devices into one
-   single entity for the pxa2xx_pcmcia device so this structure
-   is used which is setup by the platform code
-*/
-struct scoop_pcmcia_config *platform_scoop_config;
 #define SCOOP_DEV platform_scoop_config->devs
 
 static void sharpsl_pcmcia_init_reset(struct soc_pcmcia_socket *skt)
@@ -230,7 +222,7 @@ static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
        sharpsl_pcmcia_init_reset(skt);
 }
 
-static struct pcmcia_low_level sharpsl_pcmcia_ops = {
+static struct pcmcia_low_level sharpsl_pcmcia_ops __initdata = {
        .owner                  = THIS_MODULE,
        .hw_init                = sharpsl_pcmcia_hw_init,
        .hw_shutdown            = sharpsl_pcmcia_hw_shutdown,
@@ -263,30 +255,27 @@ static int __init sharpsl_pcmcia_init(void)
 {
        int ret;
 
-       sharpsl_pcmcia_ops.nr=platform_scoop_config->num_devs;
-       sharpsl_pcmcia_device = kzalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL);
+       sharpsl_pcmcia_ops.nr = platform_scoop_config->num_devs;
+       sharpsl_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
+
        if (!sharpsl_pcmcia_device)
                return -ENOMEM;
 
-       sharpsl_pcmcia_device->name = "pxa2xx-pcmcia";
-       sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops;
-       sharpsl_pcmcia_device->dev.parent=platform_scoop_config->devs[0].dev;
+       ret = platform_device_add_data(sharpsl_pcmcia_device,
+                       &sharpsl_pcmcia_ops, sizeof(sharpsl_pcmcia_ops));
+       if (ret == 0) {
+               sharpsl_pcmcia_device->dev.parent = platform_scoop_config->devs[0].dev;
+               ret = platform_device_add(sharpsl_pcmcia_device);
+       }
 
-       ret = platform_device_register(sharpsl_pcmcia_device);
        if (ret)
-               kfree(sharpsl_pcmcia_device);
+               platform_device_put(sharpsl_pcmcia_device);
 
        return ret;
 }
 
 static void __exit sharpsl_pcmcia_exit(void)
 {
-       /*
-        * This call is supposed to free our sharpsl_pcmcia_device.
-        * Unfortunately platform_device don't have a free method, and
-        * we can't assume it's free of any reference at this point so we
-        * can't free it either.
-        */
        platform_device_unregister(sharpsl_pcmcia_device);
 }
 
@@ -296,3 +285,4 @@ module_exit(sharpsl_pcmcia_exit);
 
 MODULE_DESCRIPTION("Sharp SL Series PCMCIA Support");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:pxa2xx-pcmcia");