]> err.no Git - linux-2.6/commitdiff
[PATCH] pcmcia: add pcmcia_disable_device
authorDominik Brodowski <linux@dominikbrodowski.net>
Sun, 15 Jan 2006 08:32:39 +0000 (09:32 +0100)
committerDominik Brodowski <linux@dominikbrodowski.net>
Fri, 31 Mar 2006 15:15:50 +0000 (17:15 +0200)
pcmcia_disable_device(struct pcmcia_device *p_dev) performs the necessary
cleanups upon device or driver removal: it calls the appropriate
pcmcia_release_* functions, and can replace (most) of the current drivers'
_release() functions.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
43 files changed:
Documentation/pcmcia/driver-changes.txt
drivers/bluetooth/bluecard_cs.c
drivers/bluetooth/bt3c_cs.c
drivers/bluetooth/btuart_cs.c
drivers/bluetooth/dtl1_cs.c
drivers/char/pcmcia/cm4000_cs.c
drivers/char/pcmcia/cm4040_cs.c
drivers/char/pcmcia/synclink_cs.c
drivers/ide/legacy/ide-cs.c
drivers/isdn/hardware/avm/avm_cs.c
drivers/isdn/hisax/avma1_cs.c
drivers/isdn/hisax/elsa_cs.c
drivers/isdn/hisax/sedlbauer_cs.c
drivers/isdn/hisax/teles_cs.c
drivers/net/pcmcia/3c574_cs.c
drivers/net/pcmcia/3c589_cs.c
drivers/net/pcmcia/axnet_cs.c
drivers/net/pcmcia/com20020_cs.c
drivers/net/pcmcia/fmvj18x_cs.c
drivers/net/pcmcia/ibmtr_cs.c
drivers/net/pcmcia/nmclan_cs.c
drivers/net/pcmcia/pcnet_cs.c
drivers/net/pcmcia/smc91c92_cs.c
drivers/net/pcmcia/xirc2ps_cs.c
drivers/net/wireless/airo_cs.c
drivers/net/wireless/atmel_cs.c
drivers/net/wireless/hostap/hostap_cs.c
drivers/net/wireless/netwave_cs.c
drivers/net/wireless/orinoco_cs.c
drivers/net/wireless/spectrum_cs.c
drivers/net/wireless/wavelan_cs.c
drivers/net/wireless/wl3501_cs.c
drivers/parport/parport_cs.c
drivers/pcmcia/pcmcia_resource.c
drivers/scsi/pcmcia/aha152x_stub.c
drivers/scsi/pcmcia/fdomain_stub.c
drivers/scsi/pcmcia/nsp_cs.c
drivers/scsi/pcmcia/qlogic_stub.c
drivers/scsi/pcmcia/sym53c500_cs.c
drivers/serial/serial_cs.c
include/pcmcia/cs.h
sound/pcmcia/pdaudiocf/pdaudiocf.c
sound/pcmcia/vx/vxpocket.c

index 97420f08c7869acf063b233890d7b521e735179d..c89a5e29bb4c2b9e6fc416bd048a1afc6f28adcc 100644 (file)
@@ -1,5 +1,11 @@
 This file details changes in 2.6 which affect PCMCIA card driver authors:
 
+* New release helper (as of 2.6.17)
+   Instead of calling pcmcia_release_{configuration,io,irq,win}, all that's
+   necessary now is calling pcmcia_disable_device. As there is no valid
+   reason left to call pcmcia_release_io and pcmcia_release_irq, they will
+   be removed soon.
+
 * Unify detach and REMOVAL event code, as well as attach and INSERTION
   code (as of 2.6.16)
        void (*remove)          (struct pcmcia_device *dev);
index 9888bc1517555b7e85a1c7da2930bf1d71c76f68..128e41609a5dea3d8f3752f37d30fcb1ffc523d2 100644 (file)
@@ -1002,13 +1002,7 @@ static void bluecard_release(dev_link_t *link)
 
        del_timer(&(info->timer));
 
-       link->dev = NULL;
-
-       pcmcia_release_configuration(link->handle);
-       pcmcia_release_io(link->handle, &link->io);
-       pcmcia_release_irq(link->handle, &link->irq);
-
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 }
 
 static int bluecard_suspend(struct pcmcia_device *dev)
index 7e21b1ff27c4213fb78de899fc03f11fe7fe0e58..ac1410c0a43e2b37015967c0f843993f45233826 100644 (file)
@@ -839,13 +839,7 @@ static void bt3c_release(dev_link_t *link)
        if (link->state & DEV_PRESENT)
                bt3c_close(info);
 
-       link->dev = NULL;
-
-       pcmcia_release_configuration(link->handle);
-       pcmcia_release_io(link->handle, &link->io);
-       pcmcia_release_irq(link->handle, &link->irq);
-
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 }
 
 static int bt3c_suspend(struct pcmcia_device *dev)
index 7b4bff4cfa2dfac57daa86f1c96ae9c3b0c947de..8cd54bb199f95d369fecefb036c6275d4c535299 100644 (file)
@@ -768,13 +768,7 @@ static void btuart_release(dev_link_t *link)
        if (link->state & DEV_PRESENT)
                btuart_close(info);
 
-       link->dev = NULL;
-
-       pcmcia_release_configuration(link->handle);
-       pcmcia_release_io(link->handle, &link->io);
-       pcmcia_release_irq(link->handle, &link->irq);
-
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 }
 
 static int btuart_suspend(struct pcmcia_device *dev)
index 0449bc45ae5e53dd85f463a7e3b6a155492035fe..efbc8a543a9a1a1b2d08040cdaa6555fef20055a 100644 (file)
@@ -720,13 +720,7 @@ static void dtl1_release(dev_link_t *link)
        if (link->state & DEV_PRESENT)
                dtl1_close(info);
 
-       link->dev = NULL;
-
-       pcmcia_release_configuration(link->handle);
-       pcmcia_release_io(link->handle, &link->io);
-       pcmcia_release_irq(link->handle, &link->irq);
-
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 }
 
 static int dtl1_suspend(struct pcmcia_device *dev)
index 5fdf185154330c367fc850b5009fe132e55d848e..3ddd3da9e72001820ee4a9013950b51745235922 100644 (file)
@@ -1899,8 +1899,7 @@ static int cm4000_resume(struct pcmcia_device *p_dev)
 static void cm4000_release(dev_link_t *link)
 {
        cmm_cm4000_release(link->priv); /* delay release until device closed */
-       pcmcia_release_configuration(link->handle);
-       pcmcia_release_io(link->handle, &link->io);
+       pcmcia_disable_device(link->handle);
 }
 
 static int cm4000_attach(struct pcmcia_device *p_dev)
index 466e33bab029e6b317628649068009766f56af9f..1c355bd2be8803f86f78f956721869d5c14ea82e 100644 (file)
@@ -654,8 +654,7 @@ static int reader_resume(struct pcmcia_device *p_dev)
 static void reader_release(dev_link_t *link)
 {
        cm4040_reader_release(link->priv);
-       pcmcia_release_configuration(link->handle);
-       pcmcia_release_io(link->handle, &link->io);
+       pcmcia_disable_device(link->handle);
 }
 
 static int reader_attach(struct pcmcia_device *p_dev)
index e6b714b6390df158966a88a71dae92f09c318302..371d10b78004eaa0bb77bd5ea42f04d6b5eb2d9a 100644 (file)
@@ -710,15 +710,7 @@ static void mgslpc_release(u_long arg)
     if (debug_level >= DEBUG_LEVEL_INFO)
            printk("mgslpc_release(0x%p)\n", link);
 
-    /* Unlink the device chain */
-    link->dev = NULL;
-    link->state &= ~DEV_CONFIG;
-
-    pcmcia_release_configuration(link->handle);
-    if (link->io.NumPorts1)
-           pcmcia_release_io(link->handle, &link->io);
-    if (link->irq.AssignedIRQ)
-           pcmcia_release_irq(link->handle, &link->irq);
+    pcmcia_disable_device(link->handle);
 }
 
 static void mgslpc_detach(struct pcmcia_device *p_dev)
index 6213bd3caee5033552ea7bf20104564676c3b013..024aad6164846e5cd8c277402d0888f66e3616cb 100644 (file)
@@ -369,14 +369,8 @@ void ide_release(dev_link_t *link)
        ide_unregister(info->hd);
     }
     info->ndev = 0;
-    link->dev = NULL;
-    
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-    
-    link->state &= ~DEV_CONFIG;
 
+    pcmcia_disable_device(link->handle);
 } /* ide_release */
 
 static int ide_suspend(struct pcmcia_device *dev)
index 2a2b03ff096b6a3a5b56beddb997ac515117f932..f3889bdc8e43abeba491c6be8a357e228a6bd427 100644 (file)
@@ -367,16 +367,8 @@ found_port:
 
 static void avmcs_release(dev_link_t *link)
 {
-    b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ);
-
-    /* Unlink the device chain */
-    link->dev = NULL;
-    
-    /* Don't bother checking to see if these succeed or not */
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-    link->state &= ~DEV_CONFIG;
+       b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ);
+       pcmcia_disable_device(link->handle);
 } /* avmcs_release */
 
 static int avmcs_suspend(struct pcmcia_device *dev)
index 969da40c42486cb83a27e5bb43b49f2b7ee79956..729c2de0bc1d270fdb9ced9e299ca96e115e63b9 100644 (file)
@@ -373,21 +373,14 @@ found_port:
 
 static void avma1cs_release(dev_link_t *link)
 {
-    local_info_t *local = link->priv;
+       local_info_t *local = link->priv;
 
-    DEBUG(0, "avma1cs_release(0x%p)\n", link);
+       DEBUG(0, "avma1cs_release(0x%p)\n", link);
 
-    /* no unregister function with hisax */
-    HiSax_closecard(local->node.minor);
+       /* now unregister function with hisax */
+       HiSax_closecard(local->node.minor);
 
-    /* Unlink the device chain */
-    link->dev = NULL;
-    
-    /* Don't bother checking to see if these succeed or not */
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-    link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 } /* avma1cs_release */
 
 static int avma1cs_suspend(struct pcmcia_device *dev)
index 062fb8f0739f8761bc879902abb10d860a08f989..60c75c7c016e5079c461d98cfc1cb175f96c5341 100644 (file)
@@ -380,16 +380,8 @@ static void elsa_cs_release(dev_link_t *link)
            HiSax_closecard(local->cardnr);
        }
     }
-    /* Unlink the device chain */
-    link->dev = NULL;
-
-    /* Don't bother checking to see if these succeed or not */
-    if (link->win)
-        pcmcia_release_window(link->win);
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-    link->state &= ~DEV_CONFIG;
+
+    pcmcia_disable_device(link->handle);
 } /* elsa_cs_release */
 
 static int elsa_suspend(struct pcmcia_device *p_dev)
index 6f5213a18a8d6ea797952d5d33f012a49b3e0e2b..e59539157d195e2d85a5eed9f33e25952761e990 100644 (file)
@@ -467,23 +467,8 @@ static void sedlbauer_release(dev_link_t *link)
            HiSax_closecard(local->cardnr);
        }
     }
-    /* Unlink the device chain */
-    link->dev = NULL;
 
-    /*
-      In a normal driver, additional code may be needed to release
-      other kernel data structures associated with this device. 
-    */
-    
-    /* Don't bother checking to see if these succeed or not */
-    if (link->win)
-       pcmcia_release_window(link->win);
-    pcmcia_release_configuration(link->handle);
-    if (link->io.NumPorts1)
-       pcmcia_release_io(link->handle, &link->io);
-    if (link->irq.AssignedIRQ)
-       pcmcia_release_irq(link->handle, &link->irq);
-    link->state &= ~DEV_CONFIG;
+    pcmcia_disable_device(link->handle);
 } /* sedlbauer_release */
 
 static int sedlbauer_suspend(struct pcmcia_device *p_dev)
index 4e5c14c7240e1c1be95c177d2a6b29d037820f94..7945fd64621a3802a6ff351e291bbc1395bb1949 100644 (file)
@@ -371,16 +371,8 @@ static void teles_cs_release(dev_link_t *link)
            HiSax_closecard(local->cardnr);
        }
     }
-    /* Unlink the device chain */
-    link->dev = NULL;
-
-    /* Don't bother checking to see if these succeed or not */
-    if (link->win)
-        pcmcia_release_window(link->win);
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-    link->state &= ~DEV_CONFIG;
+
+    pcmcia_disable_device(link->handle);
 } /* teles_cs_release */
 
 static int teles_suspend(struct pcmcia_device *p_dev)
index ce90becb8bdf360dec4eddb80ecc1bf02973f160..1799660bdc6731163d55cb72dec83bad73ad1768 100644 (file)
@@ -511,13 +511,7 @@ failed:
 
 static void tc574_release(dev_link_t *link)
 {
-       DEBUG(0, "3c574_release(0x%p)\n", link);
-
-       pcmcia_release_configuration(link->handle);
-       pcmcia_release_io(link->handle, &link->io);
-       pcmcia_release_irq(link->handle, &link->irq);
-
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 }
 
 static int tc574_suspend(struct pcmcia_device *p_dev)
index 3dba50849da748a0631f12288a7e78e800c98da0..e36153851793f86228c322ba1536a8c1c45bb324 100644 (file)
@@ -386,13 +386,7 @@ failed:
 
 static void tc589_release(dev_link_t *link)
 {
-    DEBUG(0, "3c589_release(0x%p)\n", link);
-    
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-    
-    link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 }
 
 static int tc589_suspend(struct pcmcia_device *p_dev)
index 1cc94b2d76c11737842f83178f7a780811a56e97..9b9c0f19b21cd4037b8e2a4bc1dc6973544ed58e 100644 (file)
@@ -456,13 +456,7 @@ failed:
 
 static void axnet_release(dev_link_t *link)
 {
-    DEBUG(0, "axnet_release(0x%p)\n", link);
-
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-
-    link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 }
 
 static int axnet_suspend(struct pcmcia_device *p_dev)
index 2827a48ea37c64c66c0f508ae220a189ab0bb5eb..a0ec5e7aacc60f299ec3511ea48d418fbdc0b2ff 100644 (file)
@@ -377,16 +377,8 @@ failed:
 
 static void com20020_release(dev_link_t *link)
 {
-
-    DEBUG(1,"release...\n");
-
-    DEBUG(0, "com20020_release(0x%p)\n", link);
-
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-
-    link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING);
+       DEBUG(0, "com20020_release(0x%p)\n", link);
+       pcmcia_disable_device(link->handle);
 }
 
 static int com20020_suspend(struct pcmcia_device *p_dev)
index b7ac14ba8877d749c1d56184d6c663f0a00789bc..6b435e9406079985279c79b49c2ce9fb0bd8762b 100644 (file)
@@ -674,16 +674,8 @@ static int fmvj18x_setup_mfc(dev_link_t *link)
 
 static void fmvj18x_release(dev_link_t *link)
 {
-
-    DEBUG(0, "fmvj18x_release(0x%p)\n", link);
-
-    /* Don't bother checking to see if these succeed or not */
-    pcmcia_release_window(link->win);
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-    
-    link->state &= ~DEV_CONFIG;
+       DEBUG(0, "fmvj18x_release(0x%p)\n", link);
+       pcmcia_disable_device(link->handle);
 }
 
 static int fmvj18x_suspend(struct pcmcia_device *p_dev)
index b9c7e39576f577e099b7918d16badab7abcccc5a..1948a0bc198d99b598a0c406a775bba8614eb0c9 100644 (file)
@@ -348,22 +348,17 @@ failed:
 
 static void ibmtr_release(dev_link_t *link)
 {
-    ibmtr_dev_t *info = link->priv;
-    struct net_device *dev = info->dev;
-
-    DEBUG(0, "ibmtr_release(0x%p)\n", link);
+       ibmtr_dev_t *info = link->priv;
+       struct net_device *dev = info->dev;
 
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-    if (link->win) {
-       struct tok_info *ti = netdev_priv(dev);
-       iounmap(ti->mmio);
-       pcmcia_release_window(link->win);
-       pcmcia_release_window(info->sram_win_handle);
-    }
+       DEBUG(0, "ibmtr_release(0x%p)\n", link);
 
-    link->state &= ~DEV_CONFIG;
+       if (link->win) {
+               struct tok_info *ti = netdev_priv(dev);
+               iounmap(ti->mmio);
+               pcmcia_release_window(info->sram_win_handle);
+       }
+       pcmcia_disable_device(link->handle);
 }
 
 static int ibmtr_suspend(struct pcmcia_device *p_dev)
index 787176c57fd9e9aaf28e7a12667bbd8af4171efc..76ef453d172d8d2baa82203ef0f8616031c731e8 100644 (file)
@@ -765,14 +765,8 @@ nmclan_release
 ---------------------------------------------------------------------------- */
 static void nmclan_release(dev_link_t *link)
 {
-
-  DEBUG(0, "nmclan_release(0x%p)\n", link);
-
-  pcmcia_release_configuration(link->handle);
-  pcmcia_release_io(link->handle, &link->io);
-  pcmcia_release_irq(link->handle, &link->irq);
-
-  link->state &= ~DEV_CONFIG;
+       DEBUG(0, "nmclan_release(0x%p)\n", link);
+       pcmcia_disable_device(link->handle);
 }
 
 static int nmclan_suspend(struct pcmcia_device *p_dev)
index b46e5f703efabb88df07eb7ff6cc069be774621a..52f44bdff1f7f61408d299cef61b1459f226ca10 100644 (file)
@@ -732,19 +732,14 @@ failed:
 
 static void pcnet_release(dev_link_t *link)
 {
-    pcnet_dev_t *info = PRIV(link->priv);
+       pcnet_dev_t *info = PRIV(link->priv);
 
-    DEBUG(0, "pcnet_release(0x%p)\n", link);
+       DEBUG(0, "pcnet_release(0x%p)\n", link);
 
-    if (info->flags & USE_SHMEM) {
-       iounmap(info->base);
-       pcmcia_release_window(link->win);
-    }
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
+       if (info->flags & USE_SHMEM)
+               iounmap(info->base);
 
-    link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 }
 
 /*======================================================================
index 8839c4faafd6e19d0fd523d850af52eab6ee2a91..56700b154d44ce4336c29fa7b519a727e4a25cb4 100644 (file)
@@ -1181,20 +1181,13 @@ config_failed:                  /* CS_EXIT_TEST() calls jump to here... */
 
 static void smc91c92_release(dev_link_t *link)
 {
-
-    DEBUG(0, "smc91c92_release(0x%p)\n", link);
-
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-    if (link->win) {
-       struct net_device *dev = link->priv;
-       struct smc_private *smc = netdev_priv(dev);
-       iounmap(smc->base);
-       pcmcia_release_window(link->win);
-    }
-
-    link->state &= ~DEV_CONFIG;
+       DEBUG(0, "smc91c92_release(0x%p)\n", link);
+       if (link->win) {
+               struct net_device *dev = link->priv;
+               struct smc_private *smc = netdev_priv(dev);
+               iounmap(smc->base);
+       }
+       pcmcia_disable_device(link->handle);
 }
 
 /*======================================================================
index eed496803fe40726eca6449f20b223d56b4999d5..2b57a87371f36d4380e04deedee8f96159791fce 100644 (file)
@@ -1090,21 +1090,15 @@ xirc2ps_config(dev_link_t * link)
 static void
 xirc2ps_release(dev_link_t *link)
 {
+       DEBUG(0, "release(0x%p)\n", link);
 
-    DEBUG(0, "release(0x%p)\n", link);
-
-    if (link->win) {
-       struct net_device *dev = link->priv;
-       local_info_t *local = netdev_priv(dev);
-       if (local->dingo)
-           iounmap(local->dingo_ccr - 0x0800);
-       pcmcia_release_window(link->win);
-    }
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-    link->state &= ~DEV_CONFIG;
-
+       if (link->win) {
+               struct net_device *dev = link->priv;
+               local_info_t *local = netdev_priv(dev);
+               if (local->dingo)
+                       iounmap(local->dingo_ccr - 0x0800);
+       }
+       pcmcia_disable_device(link->handle);
 } /* xirc2ps_release */
 
 /*====================================================================*/
index a496460ce22499e08fa2cfef0d5c97a90db2b749..489ef7f3d950e7e30adae53e33c5a9a818687277 100644 (file)
@@ -429,24 +429,7 @@ static void airo_config(dev_link_t *link)
 static void airo_release(dev_link_t *link)
 {
        DEBUG(0, "airo_release(0x%p)\n", link);
-       
-       /* Unlink the device chain */
-       link->dev = NULL;
-       
-       /*
-         In a normal driver, additional code may be needed to release
-         other kernel data structures associated with this device. 
-       */
-       
-       /* Don't bother checking to see if these succeed or not */
-       if (link->win)
-               pcmcia_release_window(link->win);
-       pcmcia_release_configuration(link->handle);
-       if (link->io.NumPorts1)
-               pcmcia_release_io(link->handle, &link->io);
-       if (link->irq.AssignedIRQ)
-               pcmcia_release_irq(link->handle, &link->irq);
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 }
 
 static int airo_suspend(struct pcmcia_device *p_dev)
index d6f4a5a3e55a614cb1131d66e91c95e7b2eec840..1da8e6197ffbb405c996712553a5f8f2c09f3b9c 100644 (file)
@@ -418,23 +418,14 @@ static void atmel_config(dev_link_t *link)
 static void atmel_release(dev_link_t *link)
 {
        struct net_device *dev = ((local_info_t*)link->priv)->eth_dev;
-               
+
        DEBUG(0, "atmel_release(0x%p)\n", link);
-       
-       /* Unlink the device chain */
-       link->dev = NULL;
-       
-       if (dev) 
+
+       if (dev)
                stop_atmel_card(dev);
-       ((local_info_t*)link->priv)->eth_dev = NULL; 
-       
-       /* Don't bother checking to see if these succeed or not */
-       pcmcia_release_configuration(link->handle);
-       if (link->io.NumPorts1)
-               pcmcia_release_io(link->handle, &link->io);
-       if (link->irq.AssignedIRQ)
-               pcmcia_release_irq(link->handle, &link->irq);
-       link->state &= ~DEV_CONFIG;
+       ((local_info_t*)link->priv)->eth_dev = NULL;
+
+       pcmcia_disable_device(link->handle);
 }
 
 static int atmel_suspend(struct pcmcia_device *dev)
index d335b250923a18dfcb1a67369edf95ca43fea31c..7a1023f3875b79a942f0059b67d3b8e63aafb08b 100644 (file)
@@ -804,16 +804,7 @@ static void prism2_release(u_long arg)
                iface->local->shutdown = 1;
        }
 
-       if (link->win)
-               pcmcia_release_window(link->win);
-       pcmcia_release_configuration(link->handle);
-       if (link->io.NumPorts1)
-               pcmcia_release_io(link->handle, &link->io);
-       if (link->irq.AssignedIRQ)
-               pcmcia_release_irq(link->handle, &link->irq);
-
-       link->state &= ~DEV_CONFIG;
-
+       pcmcia_disable_device(link->handle);
        PDEBUG(DEBUG_FLOW, "release - done\n");
 }
 
index 75ce6ddb0cf5faa182a0bae3a45b64c7f5862579..dfb47ac9da5051f7d8693b21bd1ad3c1ee576ee1 100644 (file)
@@ -869,21 +869,14 @@ failed:
  */
 static void netwave_release(dev_link_t *link)
 {
-    struct net_device *dev = link->priv;
-    netwave_private *priv = netdev_priv(dev);
-
-    DEBUG(0, "netwave_release(0x%p)\n", link);
+       struct net_device *dev = link->priv;
+       netwave_private *priv = netdev_priv(dev);
 
-    /* Don't bother checking to see if these succeed or not */
-    if (link->win) {
-       iounmap(priv->ramBase);
-       pcmcia_release_window(link->win);
-    }
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
+       DEBUG(0, "netwave_release(0x%p)\n", link);
 
-    link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
+       if (link->win)
+               iounmap(priv->ramBase);
 }
 
 static int netwave_suspend(struct pcmcia_device *p_dev)
index ec6f2a48895b5a904211b21b069aff333dceede2..7fdc4ff551076e15c2510a7b1f5768263daee40a 100644 (file)
@@ -416,13 +416,7 @@ orinoco_cs_release(dev_link_t *link)
        priv->hw_unavailable++;
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       /* Don't bother checking to see if these succeed or not */
-       pcmcia_release_configuration(link->handle);
-       if (link->io.NumPorts1)
-               pcmcia_release_io(link->handle, &link->io);
-       if (link->irq.AssignedIRQ)
-               pcmcia_release_irq(link->handle, &link->irq);
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
        if (priv->hw.iobase)
                ioport_unmap(priv->hw.iobase);
 }                              /* orinoco_cs_release */
index 5fa6fbe35bb9406bb323afcf4be515faed133836..78320c1a1c15eaf463d7939dea14c34fd45c0316 100644 (file)
@@ -894,13 +894,7 @@ spectrum_cs_release(dev_link_t *link)
        priv->hw_unavailable++;
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       /* Don't bother checking to see if these succeed or not */
-       pcmcia_release_configuration(link->handle);
-       if (link->io.NumPorts1)
-               pcmcia_release_io(link->handle, &link->io);
-       if (link->irq.AssignedIRQ)
-               pcmcia_release_irq(link->handle, &link->irq);
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
        if (priv->hw.iobase)
                ioport_unmap(priv->hw.iobase);
 }                              /* spectrum_cs_release */
index 98122f3a4bc272bce7df9228dd5e4adf1f50dfd4..696aeb9d8f521390acdc388bfa02f05c7761aede 100644 (file)
@@ -4098,24 +4098,18 @@ wv_pcmcia_config(dev_link_t *   link)
 static void
 wv_pcmcia_release(dev_link_t *link)
 {
-  struct net_device *  dev = (struct net_device *) link->priv;
-  net_local *          lp = netdev_priv(dev);
+       struct net_device *     dev = (struct net_device *) link->priv;
+       net_local *             lp = netdev_priv(dev);
 
 #ifdef DEBUG_CONFIG_TRACE
-  printk(KERN_DEBUG "%s: -> wv_pcmcia_release(0x%p)\n", dev->name, link);
+       printk(KERN_DEBUG "%s: -> wv_pcmcia_release(0x%p)\n", dev->name, link);
 #endif
 
-  /* Don't bother checking to see if these succeed or not */
-  iounmap(lp->mem);
-  pcmcia_release_window(link->win);
-  pcmcia_release_configuration(link->handle);
-  pcmcia_release_io(link->handle, &link->io);
-  pcmcia_release_irq(link->handle, &link->irq);
-
-  link->state &= ~DEV_CONFIG;
+       iounmap(lp->mem);
+       pcmcia_disable_device(link->handle);
 
 #ifdef DEBUG_CONFIG_TRACE
-  printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name);
+       printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name);
 #endif
 }
 
index 48e10b0c7e747ede33fe13c5dbd6582511aee870..0c81b3e7d7ff9621ae2379ad397bb4bdc808730b 100644 (file)
@@ -2149,16 +2149,10 @@ static void wl3501_release(dev_link_t *link)
        struct net_device *dev = link->priv;
 
        /* Unlink the device chain */
-       if (link->dev) {
+       if (link->dev)
                unregister_netdev(dev);
-               link->dev = NULL;
-       }
 
-       /* Don't bother checking to see if these succeed or not */
-       pcmcia_release_configuration(link->handle);
-       pcmcia_release_io(link->handle, &link->io);
-       pcmcia_release_irq(link->handle, &link->irq);
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 }
 
 static int wl3501_suspend(struct pcmcia_device *p_dev)
index d0fc8be569540dc8eaee4c52464aa2895035d452..7edd7ef6c31f3f74c3dd42a633cc142fede6f479 100644 (file)
@@ -267,23 +267,17 @@ failed:
 
 void parport_cs_release(dev_link_t *link)
 {
-    parport_info_t *info = link->priv;
-    
-    DEBUG(0, "parport_release(0x%p)\n", link);
+       parport_info_t *info = link->priv;
 
-    if (info->ndev) {
-       struct parport *p = info->port;
-       parport_pc_unregister_port(p);
-    }
-    info->ndev = 0;
-    link->dev = NULL;
-    
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
-    
-    link->state &= ~DEV_CONFIG;
+       DEBUG(0, "parport_release(0x%p)\n", link);
+
+       if (info->ndev) {
+               struct parport *p = info->port;
+               parport_pc_unregister_port(p);
+       }
+       info->ndev = 0;
 
+       pcmcia_disable_device(link->handle);
 } /* parport_cs_release */
 
 static int parport_suspend(struct pcmcia_device *dev)
index dbd5571064d13d6985fbc3d5adc9657574e33376..555c8698ebd904ea6831c0eb5dce754370047c8f 100644 (file)
@@ -451,20 +451,20 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
 {
        pccard_io_map io = { 0, 0, 0, 0, 1 };
        struct pcmcia_socket *s = p_dev->socket;
+       config_t *c = p_dev->function_config;
        int i;
 
-       if (!(p_dev->state & CLIENT_CONFIG_LOCKED))
-               return CS_BAD_HANDLE;
-       p_dev->state &= ~CLIENT_CONFIG_LOCKED;
-
-       if (!(p_dev->state & CLIENT_STALE)) {
-               config_t *c = p_dev->function_config;
+       if (p_dev->state & CLIENT_CONFIG_LOCKED) {
+               p_dev->state &= ~CLIENT_CONFIG_LOCKED;
                if (--(s->lock_count) == 0) {
                        s->socket.flags = SS_OUTPUT_ENA;   /* Is this correct? */
                        s->socket.Vpp = 0;
                        s->socket.io_irq = 0;
                        s->ops->set_socket(s, &s->socket);
                }
+       }
+       if (c->state & CONFIG_LOCKED) {
+               c->state &= ~CONFIG_LOCKED;
                if (c->state & CONFIG_IO_REQ)
                        for (i = 0; i < MAX_IO_WIN; i++) {
                                if (!s->io[i].res)
@@ -475,7 +475,6 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
                                io.map = i;
                                s->ops->set_io_map(s, &io);
                        }
-               c->state &= ~CONFIG_LOCKED;
        }
 
        return CS_SUCCESS;
@@ -494,22 +493,20 @@ EXPORT_SYMBOL(pcmcia_release_configuration);
 int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
 {
        struct pcmcia_socket *s = p_dev->socket;
+       config_t *c = p_dev->function_config;
 
        if (!(p_dev->state & CLIENT_IO_REQ))
                return CS_BAD_HANDLE;
+
        p_dev->state &= ~CLIENT_IO_REQ;
 
-       if (!(p_dev->state & CLIENT_STALE)) {
-               config_t *c = p_dev->function_config;
-               if (c->state & CONFIG_LOCKED)
-                       return CS_CONFIGURATION_LOCKED;
-               if ((c->io.BasePort1 != req->BasePort1) ||
-                   (c->io.NumPorts1 != req->NumPorts1) ||
-                   (c->io.BasePort2 != req->BasePort2) ||
-                   (c->io.NumPorts2 != req->NumPorts2))
-                       return CS_BAD_ARGS;
-               c->state &= ~CONFIG_IO_REQ;
-       }
+       if ((c->io.BasePort1 != req->BasePort1) ||
+           (c->io.NumPorts1 != req->NumPorts1) ||
+           (c->io.BasePort2 != req->BasePort2) ||
+           (c->io.NumPorts2 != req->NumPorts2))
+               return CS_BAD_ARGS;
+
+       c->state &= ~CONFIG_IO_REQ;
 
        release_io_space(s, req->BasePort1, req->NumPorts1);
        if (req->NumPorts2)
@@ -523,22 +520,21 @@ EXPORT_SYMBOL(pcmcia_release_io);
 int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
 {
        struct pcmcia_socket *s = p_dev->socket;
+       config_t *c= p_dev->function_config;
+
        if (!(p_dev->state & CLIENT_IRQ_REQ))
                return CS_BAD_HANDLE;
        p_dev->state &= ~CLIENT_IRQ_REQ;
 
-       if (!(p_dev->state & CLIENT_STALE)) {
-               config_t *c= p_dev->function_config;
-               if (c->state & CONFIG_LOCKED)
-                       return CS_CONFIGURATION_LOCKED;
-               if (c->irq.Attributes != req->Attributes)
-                       return CS_BAD_ATTRIBUTE;
-               if (s->irq.AssignedIRQ != req->AssignedIRQ)
-                       return CS_BAD_IRQ;
-               if (--s->irq.Config == 0) {
-                       c->state &= ~CONFIG_IRQ_REQ;
-                       s->irq.AssignedIRQ = 0;
-               }
+       if (c->state & CONFIG_LOCKED)
+               return CS_CONFIGURATION_LOCKED;
+       if (c->irq.Attributes != req->Attributes)
+               return CS_BAD_ATTRIBUTE;
+       if (s->irq.AssignedIRQ != req->AssignedIRQ)
+               return CS_BAD_IRQ;
+       if (--s->irq.Config == 0) {
+               c->state &= ~CONFIG_IRQ_REQ;
+               s->irq.AssignedIRQ = 0;
        }
 
        if (req->Attributes & IRQ_HANDLE_PRESENT) {
@@ -929,3 +925,18 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
        return CS_SUCCESS;
 } /* pcmcia_request_window */
 EXPORT_SYMBOL(pcmcia_request_window);
+
+void pcmcia_disable_device(struct pcmcia_device *p_dev) {
+       if (!p_dev->instance)
+               return;
+
+       pcmcia_release_configuration(p_dev);
+       pcmcia_release_io(p_dev, &p_dev->instance->io);
+       pcmcia_release_irq(p_dev, &p_dev->instance->irq);
+       if (&p_dev->instance->win)
+               pcmcia_release_window(p_dev->instance->win);
+
+       p_dev->instance->dev = NULL;
+       p_dev->instance->state &= ~DEV_CONFIG;
+}
+EXPORT_SYMBOL(pcmcia_disable_device);
index 5609847e254a8f8e08be000651df5a09b28324da..e7f9d26a0d7ca0e8b12354c767505303cdc7309e 100644 (file)
@@ -248,13 +248,7 @@ static void aha152x_release_cs(dev_link_t *link)
        scsi_info_t *info = link->priv;
 
        aha152x_release(info->host);
-       link->dev = NULL;
-    
-       pcmcia_release_configuration(link->handle);
-       pcmcia_release_io(link->handle, &link->io);
-       pcmcia_release_irq(link->handle, &link->irq);
-    
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 }
 
 static int aha152x_suspend(struct pcmcia_device *dev)
index 788c58d805f39cbac64db4f4e601f19f70c43524..fb7221cf511fcda8768b37a418fbc2e541c6183f 100644 (file)
@@ -209,20 +209,13 @@ cs_failed:
 
 static void fdomain_release(dev_link_t *link)
 {
-    scsi_info_t *info = link->priv;
-
-    DEBUG(0, "fdomain_release(0x%p)\n", link);
-
-    scsi_remove_host(info->host);
-    link->dev = NULL;
-    
-    pcmcia_release_configuration(link->handle);
-    pcmcia_release_io(link->handle, &link->io);
-    pcmcia_release_irq(link->handle, &link->irq);
+       scsi_info_t *info = link->priv;
 
-    scsi_unregister(info->host);
+       DEBUG(0, "fdomain_release(0x%p)\n", link);
 
-    link->state &= ~DEV_CONFIG;
+       scsi_remove_host(info->host);
+       pcmcia_disable_device(link->handle);
+       scsi_unregister(info->host);
 }
 
 /*====================================================================*/
index 9e3ab3fd53555528471ef7d489c877c001ffab58..dd383c538d98f0a637bd07bacbc37c2edc6dbc3a 100644 (file)
@@ -1974,16 +1974,9 @@ static void nsp_cs_release(dev_link_t *link)
                if (data != NULL) {
                        iounmap((void *)(data->MmioAddress));
                }
-               pcmcia_release_window(link->win);
        }
-       pcmcia_release_configuration(link->handle);
-       if (link->io.NumPorts1) {
-               pcmcia_release_io(link->handle, &link->io);
-       }
-       if (link->irq.AssignedIRQ) {
-               pcmcia_release_irq(link->handle, &link->irq);
-       }
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,2))
        if (info->host != NULL) {
                scsi_host_put(info->host);
index dce7e687fd4a2a2caf597026b5f6be7d3af6a71c..70269fc10f300c325a154417e4a8f2438a458984 100644 (file)
@@ -289,6 +289,7 @@ out:
 cs_failed:
        cs_error(link->handle, last_fn, last_ret);
        link->dev = NULL;
+
        pcmcia_release_configuration(link->handle);
        pcmcia_release_io(link->handle, &link->io);
        pcmcia_release_irq(link->handle, &link->irq);
@@ -306,17 +307,11 @@ static void qlogic_release(dev_link_t *link)
        DEBUG(0, "qlogic_release(0x%p)\n", link);
 
        scsi_remove_host(info->host);
-       link->dev = NULL;
 
        free_irq(link->irq.AssignedIRQ, info->host);
-
-       pcmcia_release_configuration(link->handle);
-       pcmcia_release_io(link->handle, &link->io);
-       pcmcia_release_irq(link->handle, &link->irq);
+       pcmcia_disable_device(link->handle);
 
        scsi_host_put(info->host);
-
-       link->state &= ~DEV_CONFIG;
 }
 
 /*====================================================================*/
index 3a4dd6f5b81fb55e45f3f2932d68f589e7b7d930..42d002b6d1a53f2a337e84b8a92b0503dbbc3122 100644 (file)
@@ -550,13 +550,7 @@ SYM53C500_release(dev_link_t *link)
        if (shost->io_port && shost->n_io_port)
                release_region(shost->io_port, shost->n_io_port);
 
-       link->dev = NULL;
-
-       pcmcia_release_configuration(link->handle);
-       pcmcia_release_io(link->handle, &link->io);
-       pcmcia_release_irq(link->handle, &link->irq);
-
-       link->state &= ~DEV_CONFIG;
+       pcmcia_disable_device(link->handle);
 
        scsi_host_put(shost);
 } /* SYM53C500_release */
index 2307d9407a49863715b0ca53f66112c620474038..ff38820a03f549b603e6bd262b2ce353a7ce9a99 100644 (file)
@@ -141,11 +141,8 @@ static void serial_remove(dev_link_t *link)
 
                info->link.dev = NULL;
 
-               if (!info->slave) {
-                       pcmcia_release_configuration(info->link.handle);
-                       pcmcia_release_io(info->link.handle, &info->link.io);
-                       pcmcia_release_irq(info->link.handle, &info->link.irq);
-               }
+               if (!info->slave)
+                       pcmcia_disable_device(link->handle);
 
                info->link.state &= ~DEV_CONFIG;
        }
index eda32a595810eede065ee014ccd8afa38e3e1134..a5d8df24d56c20f092bf682584e30d3e13a810d6 100644 (file)
@@ -392,6 +392,8 @@ int pcmcia_eject_card(struct pcmcia_socket *skt);
 int pcmcia_insert_card(struct pcmcia_socket *skt);
 int pccard_reset_card(struct pcmcia_socket *skt);
 
+void pcmcia_disable_device(struct pcmcia_device *p_dev);
+
 struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt);
 void pcmcia_put_socket(struct pcmcia_socket *skt);
 
index 77caf43a310903c90ee4c7f7b6fa813ffbef6c9e..a2d3eb47f83c8839c66717760d9de1a5f03cdd41 100644 (file)
@@ -62,13 +62,7 @@ static void snd_pdacf_detach(struct pcmcia_device *p_dev);
 
 static void pdacf_release(dev_link_t *link)
 {
-       if (link->state & DEV_CONFIG) {
-               /* release cs resources */
-               pcmcia_release_configuration(link->handle);
-               pcmcia_release_io(link->handle, &link->io);
-               pcmcia_release_irq(link->handle, &link->irq);
-               link->state &= ~DEV_CONFIG;
-       }
+       pcmcia_disable_device(link->handle);
 }
 
 /*
index 66900d20a42f37c88b9e6c9a4c7e185a46ccc077..92788744bc48309f7b6e5c86628fc3031869d2ef 100644 (file)
@@ -61,13 +61,7 @@ static unsigned int card_alloc;
  */
 static void vxpocket_release(dev_link_t *link)
 {
-       if (link->state & DEV_CONFIG) {
-               /* release cs resources */
-               pcmcia_release_configuration(link->handle);
-               pcmcia_release_io(link->handle, &link->io);
-               pcmcia_release_irq(link->handle, &link->irq);
-               link->state &= ~DEV_CONFIG;
-       }
+       pcmcia_disable_device(link->handle);
 }
 
 /*