drm/radeon/kms: add trivial debugging for voltage
[safe/jmp/linux-2.6] / drivers / pcmcia / au1000_generic.c
index 551bde5..88c4c40 100644 (file)
@@ -41,7 +41,9 @@
 #include <linux/notifier.h>
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
+#include <linux/mutex.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -71,7 +73,7 @@ extern struct au1000_pcmcia_socket au1000_pcmcia_socket[];
 u32 *pcmcia_base_vaddrs[2];
 extern const unsigned long mips_io_port_base;
 
-DECLARE_MUTEX(pcmcia_sockets_lock);
+static DEFINE_MUTEX(pcmcia_sockets_lock);
 
 static int (*au1x00_pcmcia_hw_init[])(struct device *dev) = {
        au1x_board_init,
@@ -291,7 +293,7 @@ au1x00_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *map)
                skt->spd_io[map->map] = speed;
        }
 
-       map->start=(ioaddr_t)(u32)skt->virt_io;
+       map->start=(unsigned int)(u32)skt->virt_io;
        map->stop=map->start+MAP_SIZE;
        return 0;
 
@@ -372,7 +374,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
                skt->socket.resource_ops = &pccard_static_ops;
                skt->socket.ops = &au1x00_pcmcia_operations;
                skt->socket.owner = ops->owner;
-               skt->socket.dev.dev = dev;
+               skt->socket.dev.parent = dev;
 
                init_timer(&skt->poll_timer);
                skt->poll_timer.function = au1x00_pcmcia_poll_event;
@@ -404,18 +406,16 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
                        skt->virt_io = (void *)
                                (ioremap((phys_t)AU1X_SOCK0_IO, 0x1000) -
                                (u32)mips_io_port_base);
-                       skt->phys_attr = AU1X_SOCK0_PSEUDO_PHYS_ATTR;
-                       skt->phys_mem = AU1X_SOCK0_PSEUDO_PHYS_MEM;
+                       skt->phys_attr = AU1X_SOCK0_PHYS_ATTR;
+                       skt->phys_mem = AU1X_SOCK0_PHYS_MEM;
                }
-#ifndef CONFIG_MIPS_XXS1500
                else  {
                        skt->virt_io = (void *)
                                (ioremap((phys_t)AU1X_SOCK1_IO, 0x1000) -
                                (u32)mips_io_port_base);
-                       skt->phys_attr = AU1X_SOCK1_PSEUDO_PHYS_ATTR;
-                       skt->phys_mem = AU1X_SOCK1_PSEUDO_PHYS_MEM;
+                       skt->phys_attr = AU1X_SOCK1_PHYS_ATTR;
+                       skt->phys_mem = AU1X_SOCK1_PHYS_MEM;
                }
-#endif
                pcmcia_base_vaddrs[i] = (u32 *)skt->virt_io;
                ret = ops->hw_init(skt);
 
@@ -467,13 +467,13 @@ out:
        return ret;
 }
 
-int au1x00_drv_pcmcia_remove(struct device *dev)
+int au1x00_drv_pcmcia_remove(struct platform_device *dev)
 {
-       struct skt_dev_info *sinfo = dev_get_drvdata(dev);
+       struct skt_dev_info *sinfo = platform_get_drvdata(dev);
        int i;
 
-       down(&pcmcia_sockets_lock);
-       dev_set_drvdata(dev, NULL);
+       mutex_lock(&pcmcia_sockets_lock);
+       platform_set_drvdata(dev, NULL);
 
        for (i = 0; i < sinfo->nskt; i++) {
                struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
@@ -488,7 +488,7 @@ int au1x00_drv_pcmcia_remove(struct device *dev)
        }
 
        kfree(sinfo);
-       up(&pcmcia_sockets_lock);
+       mutex_unlock(&pcmcia_sockets_lock);
        return 0;
 }
 
@@ -497,28 +497,27 @@ int au1x00_drv_pcmcia_remove(struct device *dev)
  * PCMCIA "Driver" API
  */
 
-static int au1x00_drv_pcmcia_probe(struct device *dev)
+static int au1x00_drv_pcmcia_probe(struct platform_device *dev)
 {
        int i, ret = -ENODEV;
 
-       down(&pcmcia_sockets_lock);
+       mutex_lock(&pcmcia_sockets_lock);
        for (i=0; i < ARRAY_SIZE(au1x00_pcmcia_hw_init); i++) {
-               ret = au1x00_pcmcia_hw_init[i](dev);
+               ret = au1x00_pcmcia_hw_init[i](&dev->dev);
                if (ret == 0)
                        break;
        }
-       up(&pcmcia_sockets_lock);
+       mutex_unlock(&pcmcia_sockets_lock);
        return ret;
 }
 
-
-static struct device_driver au1x00_pcmcia_driver = {
+static struct platform_driver au1x00_pcmcia_driver = {
+       .driver = {
+               .name           = "au1x00-pcmcia",
+               .owner          = THIS_MODULE,
+       },
        .probe          = au1x00_drv_pcmcia_probe,
        .remove         = au1x00_drv_pcmcia_remove,
-       .name           = "au1x00-pcmcia",
-       .bus            = &platform_bus_type,
-       .suspend        = pcmcia_socket_dev_suspend,
-       .resume         = pcmcia_socket_dev_resume,
 };
 
 
@@ -532,8 +531,7 @@ static struct device_driver au1x00_pcmcia_driver = {
 static int __init au1x00_pcmcia_init(void)
 {
        int error = 0;
-       if ((error = driver_register(&au1x00_pcmcia_driver)))
-               return error;
+       error = platform_driver_register(&au1x00_pcmcia_driver);
        return error;
 }
 
@@ -543,7 +541,7 @@ static int __init au1x00_pcmcia_init(void)
  */
 static void __exit au1x00_pcmcia_exit(void)
 {
-       driver_unregister(&au1x00_pcmcia_driver);
+       platform_driver_unregister(&au1x00_pcmcia_driver);
 }
 
 module_init(au1x00_pcmcia_init);