* [PATCH] Clean up wbsd detection handling
@ 2005-09-11 20:37 Pierre Ossman
2005-09-12 7:52 ` Pierre Ossman
0 siblings, 1 reply; 3+ messages in thread
From: Pierre Ossman @ 2005-09-11 20:37 UTC (permalink / raw)
To: Russell King, LKML
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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Clean up wbsd detection handling
2005-09-11 20:37 [PATCH] Clean up wbsd detection handling Pierre Ossman
@ 2005-09-12 7:52 ` Pierre Ossman
2005-09-12 14:21 ` Pierre Ossman
0 siblings, 1 reply; 3+ messages in thread
From: Pierre Ossman @ 2005-09-12 7:52 UTC (permalink / raw)
To: Russell King; +Cc: LKML
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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Clean up wbsd detection handling
2005-09-12 7:52 ` Pierre Ossman
@ 2005-09-12 14:21 ` Pierre Ossman
0 siblings, 0 replies; 3+ messages in thread
From: Pierre Ossman @ 2005-09-12 14:21 UTC (permalink / raw)
To: Russell King; +Cc: LKML
[-- Attachment #1: Type: text/plain, Size: 244 bytes --]
Pierre Ossman wrote:
> 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>
> ---
>
Resend as attachment.
[-- Attachment #2: wbsd-detect-cleanup.patch --]
[-- Type: text/x-patch, Size: 1574 bytes --]
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 | 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)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-09-12 14:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-11 20:37 [PATCH] Clean up wbsd detection handling Pierre Ossman
2005-09-12 7:52 ` Pierre Ossman
2005-09-12 14:21 ` Pierre Ossman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox