Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds
[safe/jmp/linux-2.6] / drivers / pcmcia / db1xxx_ss.c
index 3889cf0..0f4cc3f 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/pm.h>
 #include <linux/platform_device.h>
 #include <linux/resource.h>
+#include <linux/slab.h>
 #include <linux/spinlock.h>
 
 #include <pcmcia/cs_types.h>
@@ -42,7 +43,6 @@ struct db1x_pcmcia_sock {
        int             nr;             /* socket number */
        void            *virt_io;
 
-       /* the "pseudo" addresses of the PCMCIA space. */
        phys_addr_t     phys_io;
        phys_addr_t     phys_attr;
        phys_addr_t     phys_mem;
@@ -146,7 +146,6 @@ static irqreturn_t db1200_pcmcia_cdirq(int irq, void *data)
 static int db1x_pcmcia_setup_irqs(struct db1x_pcmcia_sock *sock)
 {
        int ret;
-       unsigned long flags;
 
        if (sock->stschg_irq != -1) {
                ret = request_irq(sock->stschg_irq, db1000_pcmcia_stschgirq,
@@ -162,8 +161,6 @@ static int db1x_pcmcia_setup_irqs(struct db1x_pcmcia_sock *sock)
         * active one disabled.
         */
        if (sock->board_type == BOARD_TYPE_DB1200) {
-               local_irq_save(flags);
-
                ret = request_irq(sock->insert_irq, db1200_pcmcia_cdirq,
                                  IRQF_DISABLED, "pcmcia_insert", sock);
                if (ret)
@@ -173,17 +170,14 @@ static int db1x_pcmcia_setup_irqs(struct db1x_pcmcia_sock *sock)
                                  IRQF_DISABLED, "pcmcia_eject", sock);
                if (ret) {
                        free_irq(sock->insert_irq, sock);
-                       local_irq_restore(flags);
                        goto out1;
                }
 
-               /* disable the currently active one */
+               /* enable the currently silent one */
                if (db1200_card_inserted(sock))
-                       disable_irq_nosync(sock->insert_irq);
+                       enable_irq(sock->eject_irq);
                else
-                       disable_irq_nosync(sock->eject_irq);
-
-               local_irq_restore(flags);
+                       enable_irq(sock->insert_irq);
        } else {
                /* all other (older) Db1x00 boards use a GPIO to show
                 * card detection status:  use both-edge triggers.
@@ -437,7 +431,7 @@ static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev)
         * This includes IRQs for Carddetection/ejection, the card
         *  itself and optional status change detection.
         * Also, the memory areas covered by a socket.  For these
-        *  we require the 32bit "pseudo" addresses (see the au1000.h
+        *  we require the real 36bit addresses (see the au1000.h
         *  header for more information).
         */
 
@@ -459,11 +453,7 @@ static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev)
 
        ret = -ENODEV;
 
-       /*
-        * pseudo-attr:  The 32bit address of the PCMCIA attribute space
-        * for this socket (usually the 36bit address shifted 4 to the
-        * right).
-        */
+       /* 36bit PCMCIA Attribute area address */
        r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-attr");
        if (!r) {
                printk(KERN_ERR "pcmcia%d has no 'pseudo-attr' resource!\n",
@@ -472,10 +462,7 @@ static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev)
        }
        sock->phys_attr = r->start;
 
-       /*
-        * pseudo-mem:  The 32bit address of the PCMCIA memory space for
-        * this socket (usually the 36bit address shifted 4 to the right)
-        */
+       /* 36bit PCMCIA Memory area address */
        r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-mem");
        if (!r) {
                printk(KERN_ERR "pcmcia%d has no 'pseudo-mem' resource!\n",
@@ -484,10 +471,7 @@ static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev)
        }
        sock->phys_mem = r->start;
 
-       /*
-        * pseudo-io:  The 32bit address of the PCMCIA IO space for this
-        * socket (usually the 36bit address shifted 4 to the right).
-        */
+       /* 36bit PCMCIA IO area address */
        r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-io");
        if (!r) {
                printk(KERN_ERR "pcmcia%d has no 'pseudo-io' resource!\n",
@@ -569,37 +553,10 @@ static int __devexit db1x_pcmcia_socket_remove(struct platform_device *pdev)
        return 0;
 }
 
-#ifdef CONFIG_PM
-static int db1x_pcmcia_suspend(struct device *dev)
-{
-       return pcmcia_socket_dev_suspend(dev);
-}
-
-static int db1x_pcmcia_resume(struct device *dev)
-{
-       return pcmcia_socket_dev_resume(dev);
-}
-
-static struct dev_pm_ops db1x_pcmcia_pmops = {
-       .resume         = db1x_pcmcia_resume,
-       .suspend        = db1x_pcmcia_suspend,
-       .thaw           = db1x_pcmcia_resume,
-       .freeze         = db1x_pcmcia_suspend,
-};
-
-#define DB1XXX_SS_PMOPS &db1x_pcmcia_pmops
-
-#else
-
-#define DB1XXX_SS_PMOPS NULL
-
-#endif
-
 static struct platform_driver db1x_pcmcia_socket_driver = {
        .driver = {
                .name   = "db1xxx_pcmcia",
                .owner  = THIS_MODULE,
-               .pm     = DB1XXX_SS_PMOPS
        },
        .probe          = db1x_pcmcia_socket_probe,
        .remove         = __devexit_p(db1x_pcmcia_socket_remove),