public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre Ossman <drzeus-list@drzeus.cx>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Clean up wbsd detection handling
Date: Mon, 12 Sep 2005 09:52:06 +0200	[thread overview]
Message-ID: <432533A6.7010506@drzeus.cx> (raw)
In-Reply-To: <43249574.8000807@drzeus.cx>

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>
---

(updated to current tree)

 drivers/mmc/wbsd.c |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 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,16 +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)
 	{
@@ -1181,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)


  reply	other threads:[~2005-09-12  7:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-11 20:37 [PATCH] Clean up wbsd detection handling Pierre Ossman
2005-09-12  7:52 ` Pierre Ossman [this message]
2005-09-12 14:21   ` Pierre Ossman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=432533A6.7010506@drzeus.cx \
    --to=drzeus-list@drzeus.cx \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox