Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6.git] / drivers / pcmcia / vrc4171_card.c
index 24c547e..86e4a1a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * vrc4171_card.c, NEC VRC4171 Card Controller driver for Socket Services.
  *
- * Copyright (C) 2003-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ * Copyright (C) 2003-2005  Yoichi Yuasa <yuasa@linux-mips.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -22,7 +22,6 @@
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
-#include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/platform_device.h>
 
@@ -33,7 +32,7 @@
 #include "i82365.h"
 
 MODULE_DESCRIPTION("NEC VRC4171 Card Controllers driver for Socket Services");
-MODULE_AUTHOR("Yoichi Yuasa <yuasa@hh.iij4u.or.jp>");
+MODULE_AUTHOR("Yoichi Yuasa <yuasa@linux-mips.org>");
 MODULE_LICENSE("GPL");
 
 #define CARD_MAX_SLOTS         2
@@ -106,6 +105,7 @@ typedef struct vrc4171_socket {
        char name[24];
        int csc_irq;
        int io_irq;
+       spinlock_t lock;
 } vrc4171_socket_t;
 
 static vrc4171_socket_t vrc4171_sockets[CARD_MAX_SLOTS];
@@ -328,7 +328,7 @@ static int pccard_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
        slot = sock->sock;
        socket = &vrc4171_sockets[slot];
 
-       spin_lock_irq(&sock->lock);
+       spin_lock_irq(&socket->lock);
 
        voltage = set_Vcc_value(state->Vcc);
        exca_write_byte(slot, CARD_VOLTAGE_SELECT, voltage);
@@ -371,7 +371,7 @@ static int pccard_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
                cscint |= I365_CSC_DETECT;
         exca_write_byte(slot, I365_CSCINT, cscint);
 
-       spin_unlock_irq(&sock->lock);
+       spin_unlock_irq(&socket->lock);
 
        return 0;
 }
@@ -514,7 +514,7 @@ static inline unsigned int get_events(int slot)
        return events;
 }
 
-static irqreturn_t pccard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t pccard_interrupt(int irq, void *dev_id)
 {
        vrc4171_socket_t *socket;
        unsigned int events;
@@ -597,7 +597,7 @@ static int __devinit vrc4171_add_sockets(void)
                }
 
                sprintf(socket->name, "NEC VRC4171 Card Slot %1c", 'A' + slot);
-               socket->pcmcia_socket.dev.dev = &vrc4171_card_device.dev;
+               socket->pcmcia_socket.dev.parent = &vrc4171_card_device.dev;
                socket->pcmcia_socket.ops = &vrc4171_pccard_operations;
                socket->pcmcia_socket.owner = THIS_MODULE;
 
@@ -634,17 +634,17 @@ static void vrc4171_remove_sockets(void)
 static int __devinit vrc4171_card_setup(char *options)
 {
        if (options == NULL || *options == '\0')
-               return 0;
+               return 1;
 
        if (strncmp(options, "irq:", 4) == 0) {
                int irq;
                options += 4;
                irq = simple_strtoul(options, &options, 0);
-               if (irq >= 0 && irq < NR_IRQS)
+               if (irq >= 0 && irq < nr_irqs)
                        vrc4171_irq = irq;
 
                if (*options != ',')
-                       return 0;
+                       return 1;
                options++;
        }
 
@@ -663,10 +663,10 @@ static int __devinit vrc4171_card_setup(char *options)
                        }
 
                        if (*options != ',')
-                               return 0;
+                               return 1;
                        options++;
                } else
-                       return 0;
+                       return 1;
 
        }
 
@@ -688,7 +688,7 @@ static int __devinit vrc4171_card_setup(char *options)
                        }
 
                        if (*options != ',')
-                               return 0;
+                               return 1;
                        options++;
 
                        if (strncmp(options, "memnoprobe", 10) == 0)
@@ -700,29 +700,29 @@ static int __devinit vrc4171_card_setup(char *options)
                }
        }
 
-       return 0;
+       return 1;
 }
 
 __setup("vrc4171_card=", vrc4171_card_setup);
 
-static struct device_driver vrc4171_card_driver = {
-       .name           = vrc4171_card_name,
-       .bus            = &platform_bus_type,
-       .suspend        = pcmcia_socket_dev_suspend,
-       .resume         = pcmcia_socket_dev_resume,
+static struct platform_driver vrc4171_card_driver = {
+       .driver = {
+               .name           = vrc4171_card_name,
+               .owner          = THIS_MODULE,
+       },
 };
 
 static int __devinit vrc4171_card_init(void)
 {
        int retval;
 
-       retval = driver_register(&vrc4171_card_driver);
+       retval = platform_driver_register(&vrc4171_card_driver);
        if (retval < 0)
                return retval;
 
        retval = platform_device_register(&vrc4171_card_device);
        if (retval < 0) {
-               driver_unregister(&vrc4171_card_driver);
+               platform_driver_unregister(&vrc4171_card_driver);
                return retval;
        }
 
@@ -730,17 +730,18 @@ static int __devinit vrc4171_card_init(void)
 
        retval = vrc4171_add_sockets();
        if (retval == 0)
-               retval = request_irq(vrc4171_irq, pccard_interrupt, SA_SHIRQ,
+               retval = request_irq(vrc4171_irq, pccard_interrupt, IRQF_SHARED,
                                     vrc4171_card_name, vrc4171_sockets);
 
        if (retval < 0) {
                vrc4171_remove_sockets();
                platform_device_unregister(&vrc4171_card_device);
-               driver_unregister(&vrc4171_card_driver);
+               platform_driver_unregister(&vrc4171_card_driver);
                return retval;
        }
 
-       printk(KERN_INFO "%s, connected to IRQ %d\n", vrc4171_card_driver.name, vrc4171_irq);
+       printk(KERN_INFO "%s, connected to IRQ %d\n",
+               vrc4171_card_driver.driver.name, vrc4171_irq);
 
        return 0;
 }
@@ -750,7 +751,7 @@ static void __devexit vrc4171_card_exit(void)
        free_irq(vrc4171_irq, vrc4171_sockets);
        vrc4171_remove_sockets();
        platform_device_unregister(&vrc4171_card_device);
-       driver_unregister(&vrc4171_card_driver);
+       platform_driver_unregister(&vrc4171_card_driver);
 }
 
 module_init(vrc4171_card_init);