* [PATCH 2/2] mmc: Use mmc_delay() instead of mdelay() for time delay
@ 2011-08-25 8:54 Chunhe Lan
2011-08-25 10:23 ` Kyungmin Park
0 siblings, 1 reply; 3+ messages in thread
From: Chunhe Lan @ 2011-08-25 8:54 UTC (permalink / raw)
To: linux-mmc; +Cc: Shengzhou Liu, kumar.gala, Chris Ball, linuxppc-dev, Chunhe Lan
The mmc_delay() is a wrapper function for mdelay() and msleep().
o mdelay() -- block the system when busy-waiting.
o msleep() -- suspend the currently running task to enable CPU
to process other tasks, so it is non-blocking
regarding the whole system.
When the desired delay time is more than a period of timer interrupt,
just use msleep(). Change mdelay() to mmc_delay() to avoid chewing
CPU when busy wait.
Signed-off-by: Shengzhou Liu <b36685@freescale.com>
Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
Cc: Chris Ball <cjb@laptop.org>
---
drivers/mmc/host/sdhci.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 0e02cc1..0cb5dc1 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -27,6 +27,7 @@
#include <linux/mmc/host.h>
#include "sdhci.h"
+#include "../core/core.h"
#define DRIVER_NAME "sdhci"
@@ -186,7 +187,7 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
return;
}
timeout--;
- mdelay(1);
+ mmc_delay(1);
}
if (host->ops->platform_reset_exit)
@@ -957,7 +958,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
return;
}
timeout--;
- mdelay(1);
+ mmc_delay(1);
}
mod_timer(&host->timer, jiffies + 10 * HZ);
@@ -1127,7 +1128,7 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
return;
}
timeout--;
- mdelay(1);
+ mmc_delay(1);
}
clk |= SDHCI_CLOCK_CARD_EN;
@@ -1192,7 +1193,7 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned short power)
* can apply clock after applying power
*/
if (host->quirks & SDHCI_QUIRK_DELAY_AFTER_POWER)
- mdelay(10);
+ mmc_delay(10);
}
/*****************************************************************************\
@@ -1712,7 +1713,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc)
ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
tuning_loop_counter--;
timeout--;
- mdelay(1);
+ mmc_delay(1);
} while (ctrl & SDHCI_CTRL_EXEC_TUNING);
/*
--
1.7.5.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 2/2] mmc: Use mmc_delay() instead of mdelay() for time delay
2011-08-25 8:54 [PATCH 2/2] mmc: Use mmc_delay() instead of mdelay() for time delay Chunhe Lan
@ 2011-08-25 10:23 ` Kyungmin Park
2011-08-26 8:45 ` Lan Chunhe
0 siblings, 1 reply; 3+ messages in thread
From: Kyungmin Park @ 2011-08-25 10:23 UTC (permalink / raw)
To: Chunhe Lan; +Cc: linuxppc-dev, kumar.gala, Chris Ball, linux-mmc, Shengzhou Liu
On Thu, Aug 25, 2011 at 5:54 PM, Chunhe Lan <Chunhe.Lan@freescale.com> wrot=
e:
> The mmc_delay() is a wrapper function for mdelay() and msleep().
>
> =A0 =A0o mdelay() -- block the system when busy-waiting.
> =A0 =A0o msleep() -- suspend the currently running task to enable CPU
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0to process other tasks, so it is non-b=
locking
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0regarding the whole system.
>
> When the desired delay time is more than a period of timer interrupt,
> just use msleep(). Change mdelay() to mmc_delay() to avoid chewing
> CPU when busy wait.
>
> Signed-off-by: Shengzhou Liu <b36685@freescale.com>
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> Cc: Chris Ball <cjb@laptop.org>
> ---
> =A0drivers/mmc/host/sdhci.c | =A0 11 ++++++-----
> =A01 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 0e02cc1..0cb5dc1 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -27,6 +27,7 @@
> =A0#include <linux/mmc/host.h>
>
> =A0#include "sdhci.h"
> +#include "../core/core.h"
Doesn't better to move the mmc_delay() to "include/linux/mmc/core.h"?
and include it.
I think It's not proper include syntax using relative path.
Thank you,
Kyungmin Park
>
> =A0#define DRIVER_NAME "sdhci"
>
> @@ -186,7 +187,7 @@ static void sdhci_reset(struct sdhci_host *host, u8 m=
ask)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0timeout--;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mdelay(1);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mmc_delay(1);
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0if (host->ops->platform_reset_exit)
> @@ -957,7 +958,7 @@ static void sdhci_send_command(struct sdhci_host *hos=
t, struct mmc_command *cmd)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0timeout--;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mdelay(1);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mmc_delay(1);
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0mod_timer(&host->timer, jiffies + 10 * HZ);
> @@ -1127,7 +1128,7 @@ static void sdhci_set_clock(struct sdhci_host *host=
, unsigned int clock)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0timeout--;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mdelay(1);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mmc_delay(1);
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0clk |=3D SDHCI_CLOCK_CARD_EN;
> @@ -1192,7 +1193,7 @@ static void sdhci_set_power(struct sdhci_host *host=
, unsigned short power)
> =A0 =A0 =A0 =A0 * can apply clock after applying power
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0if (host->quirks & SDHCI_QUIRK_DELAY_AFTER_POWER)
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mdelay(10);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mmc_delay(10);
> =A0}
>
> =A0/*********************************************************************=
********\
> @@ -1712,7 +1713,7 @@ static int sdhci_execute_tuning(struct mmc_host *mm=
c)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ctrl =3D sdhci_readw(host, SDHCI_HOST_CONT=
ROL2);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tuning_loop_counter--;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0timeout--;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mdelay(1);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mmc_delay(1);
> =A0 =A0 =A0 =A0} while (ctrl & SDHCI_CTRL_EXEC_TUNING);
>
> =A0 =A0 =A0 =A0/*
> --
> 1.7.5.1
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] mmc: Use mmc_delay() instead of mdelay() for time delay
2011-08-25 10:23 ` Kyungmin Park
@ 2011-08-26 8:45 ` Lan Chunhe
0 siblings, 0 replies; 3+ messages in thread
From: Lan Chunhe @ 2011-08-26 8:45 UTC (permalink / raw)
To: Kyungmin Park, Chunhe Lan
Cc: linuxppc-dev, kumar.gala, Chris Ball, linux-mmc, Shengzhou Liu
On Thu, 25 Aug 2011 18:23:35 +0800, Kyungmin Park <kmpark@infradead.org>
wrote:
> On Thu, Aug 25, 2011 at 5:54 PM, Chunhe Lan <Chunhe.Lan@freescale.com>
> wrote:
>> The mmc_delay() is a wrapper function for mdelay() and msleep().
>>
>> o mdelay() -- block the system when busy-waiting.
>> o msleep() -- suspend the currently running task to enable CPU
>> to process other tasks, so it is non-blocking
>> regarding the whole system.
>>
>> When the desired delay time is more than a period of timer interrupt,
>> just use msleep(). Change mdelay() to mmc_delay() to avoid chewing
>> CPU when busy wait.
>>
>> Signed-off-by: Shengzhou Liu <b36685@freescale.com>
>> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
>> Cc: Chris Ball <cjb@laptop.org>
>> ---
>> drivers/mmc/host/sdhci.c | 11 ++++++-----
>> 1 files changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> index 0e02cc1..0cb5dc1 100644
>> --- a/drivers/mmc/host/sdhci.c
>> +++ b/drivers/mmc/host/sdhci.c
>> @@ -27,6 +27,7 @@
>> #include <linux/mmc/host.h>
>>
>> #include "sdhci.h"
>> +#include "../core/core.h"
>
> Doesn't better to move the mmc_delay() to "include/linux/mmc/core.h"?
> and include it.
> I think It's not proper include syntax using relative path.
Yes, your suggestion is very good.
I will move the mmc_delay() to "include/linux/mmc/core.h" .
Thanks.
-Jack Lan
> Thank you,
> Kyungmin Park
>>
>> #define DRIVER_NAME "sdhci"
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-26 8:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-25 8:54 [PATCH 2/2] mmc: Use mmc_delay() instead of mdelay() for time delay Chunhe Lan
2011-08-25 10:23 ` Kyungmin Park
2011-08-26 8:45 ` Lan Chunhe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox