Re: [RFC][PATCH] MMC: Use write timeout value as read from CSR

From: Matt Fleming
Date: Tue Sep 09 2008 - 05:07:52 EST


2008/9/9 Pierre Ossman <drzeus-mmc@xxxxxxxxx>:
> On Tue, 9 Sep 2008 08:59:11 +0100
> "Matt Fleming" <mattjfleming@xxxxxxxxxxxxxx> wrote:
>
>>
>> OK, just to be clear, where are those fields not used? They are used
>> in the new mmc_get_timeout() function.
>>
>
> Sorry, you're right. I just noticed the !host->mmc->card part and
> assumed you had your own logic in there.
>

No worries.

> Why do you have that part though? What case have you found where you
> need the timeouts and do not have properly set timeout fields?
>

This check was put in place because the function was being called
before the card structure was setup properly. I didn't actually work
out the call path but it stopped the kmmcd thread oopsing :)

How does this patch look for the SDIO case?


diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 044d84e..5ebfe35 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -249,8 +249,10 @@ void mmc_set_data_timeout(struct mmc_data *data,
const struct mmc_card *card)
* SDIO cards only define an upper 1 s limit on access.
*/
if (mmc_card_sdio(card)) {
- data->timeout_ns = 1000000000;
- data->timeout_clks = 0;
+ if (data->timeout_ns > 1000000000) {
+ data->timeout_ns = 1000000000;
+ data->timeout_clks = 0;
+ }
return;
}
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 044d84e..5ebfe35 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -249,8 +249,10 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
* SDIO cards only define an upper 1 s limit on access.
*/
if (mmc_card_sdio(card)) {
- data->timeout_ns = 1000000000;
- data->timeout_clks = 0;
+ if (data->timeout_ns > 1000000000) {
+ data->timeout_ns = 1000000000;
+ data->timeout_clks = 0;
+ }
return;
}