Merge git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-drm-fsl-dcu.git] / drivers / pcmcia / au1000_generic.c
index 87302c548c24d437fa0722a01d2d832c7a7bdf38..551bde5d943041c55f364f49cb4151aba30076ed 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
-#include <linux/config.h>
 #include <linux/cpufreq.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
@@ -241,23 +240,6 @@ au1x00_pcmcia_get_status(struct pcmcia_socket *sock, unsigned int *status)
        return 0;
 }
 
-/* au1x00_pcmcia_get_socket()
- * Implements the get_socket() operation for the in-kernel PCMCIA
- * service (formerly SS_GetSocket in Card Services). Not a very
- * exciting routine.
- *
- * Returns: 0
- */
-static int
-au1x00_pcmcia_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
-{
-  struct au1000_pcmcia_socket *skt = to_au1000_socket(sock);
-
-  debug("for sock %u\n", skt->nr);
-  *state = skt->cs_state;
-  return 0;
-}
-
 /* au1x00_pcmcia_set_socket()
  * Implements the set_socket() operation for the in-kernel PCMCIA
  * service (formerly SS_SetSocket in Card Services). We more or
@@ -352,7 +334,6 @@ static struct pccard_operations au1x00_pcmcia_operations = {
        .init                   = au1x00_pcmcia_sock_init,
        .suspend                = au1x00_pcmcia_suspend,
        .get_status             = au1x00_pcmcia_get_status,
-       .get_socket             = au1x00_pcmcia_get_socket,
        .set_socket             = au1x00_pcmcia_set_socket,
        .set_io_map             = au1x00_pcmcia_set_io_map,
        .set_mem_map            = au1x00_pcmcia_set_mem_map,
@@ -370,22 +351,22 @@ struct skt_dev_info {
 int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr)
 {
        struct skt_dev_info *sinfo;
+       struct au1000_pcmcia_socket *skt;
        int ret, i;
 
-       sinfo = kmalloc(sizeof(struct skt_dev_info), GFP_KERNEL);
+       sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL);
        if (!sinfo) {
                ret = -ENOMEM;
                goto out;
        }
 
-       memset(sinfo, 0, sizeof(struct skt_dev_info));
        sinfo->nskt = nr;
 
        /*
         * Initialise the per-socket structure.
         */
        for (i = 0; i < nr; i++) {
-               struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
+               skt = PCMCIA_SOCKET(i);
                memset(skt, 0, sizeof(*skt));
 
                skt->socket.resource_ops = &pccard_static_ops;
@@ -458,17 +439,29 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
        dev_set_drvdata(dev, sinfo);
        return 0;
 
-       do {
-               struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
+
+out_err:
+       flush_scheduled_work();
+       ops->hw_shutdown(skt);
+       while (i-- > 0) {
+               skt = PCMCIA_SOCKET(i);
 
                del_timer_sync(&skt->poll_timer);
                pcmcia_unregister_socket(&skt->socket);
-out_err:
                flush_scheduled_work();
+               if (i == 0) {
+                       iounmap(skt->virt_io + (u32)mips_io_port_base);
+                       skt->virt_io = NULL;
+               }
+#ifndef CONFIG_MIPS_XXS1500
+               else {
+                       iounmap(skt->virt_io + (u32)mips_io_port_base);
+                       skt->virt_io = NULL;
+               }
+#endif
                ops->hw_shutdown(skt);
 
-               i--;
-       } while (i > 0);
+       }
        kfree(sinfo);
 out:
        return ret;