]> err.no Git - linux-2.6/commitdiff
[MMC] Clean up wbsd detection handling
authorPierre Ossman <drzeus@drzeus.cx>
Mon, 12 Sep 2005 19:36:19 +0000 (20:36 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 12 Sep 2005 19:36:19 +0000 (20:36 +0100)
The wbsd driver's card detection routing is a bit of a mess. This
patch cleans up the routine and makes it a bit more comprihensible.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/mmc/wbsd.c

index 46e5f9a17a233413258580a7baad0414286971b8..3cbca7cbea801798bb7a1c7fb05462ed98fb89dd 100644 (file)
@@ -1136,6 +1136,7 @@ static void wbsd_tasklet_card(unsigned long param)
 {
        struct wbsd_host* host = (struct wbsd_host*)param;
        u8 csr;
+       int delay = -1;
 
        spin_lock(&host->lock);
 
@@ -1155,16 +1156,8 @@ static void wbsd_tasklet_card(unsigned long param)
                        DBG("Card inserted\n");
                        host->flags |= WBSD_FCARD_PRESENT;
 
-                       spin_unlock(&host->lock);
-
-                       /*
-                        * Delay card detection to allow electrical connections
-                        * to stabilise.
-                        */
-                       mmc_detect_change(host->mmc, msecs_to_jiffies(500));
+                       delay = 500;
                }
-               else
-                       spin_unlock(&host->lock);
        }
        else if (host->flags & WBSD_FCARD_PRESENT)
        {
@@ -1181,15 +1174,17 @@ static void wbsd_tasklet_card(unsigned long param)
                        tasklet_schedule(&host->finish_tasklet);
                }
 
-               /*
-                * Unlock first since we might get a call back.
-                */
-               spin_unlock(&host->lock);
-
-               mmc_detect_change(host->mmc, 0);
+               delay = 0;
        }
-       else
-               spin_unlock(&host->lock);
+
+       /*
+        * Unlock first since we might get a call back.
+        */
+
+       spin_unlock(&host->lock);
+
+       if (delay != -1)
+               mmc_detect_change(host->mmc, msecs_to_jiffies(delay));
 }
 
 static void wbsd_tasklet_fifo(unsigned long param)