lkml.org 
[lkml]   [2005]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] Clean up wbsd detection handling
    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>
    ---

    drivers/mmc/wbsd.c | 28 ++++++++++++----------------
    1 files changed, 12 insertions(+), 16 deletions(-)

    diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
    --- a/drivers/mmc/wbsd.c
    +++ b/drivers/mmc/wbsd.c
    @@ -1136,6 +1136,7 @@ static void wbsd_tasklet_card(unsigned l
    {
    struct wbsd_host* host = (struct wbsd_host*)param;
    u8 csr;
    + int delay = -1;

    spin_lock(&host->lock);

    @@ -1155,15 +1156,8 @@ static void wbsd_tasklet_card(unsigned l
    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)
    {
    @@ -1180,15 +1174,17 @@ static void wbsd_tasklet_card(unsigned l
    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)
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2005-09-11 22:40    [W:3.704 / U:0.508 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site