From: Namjae Jeon <linkinjeon@gmail.com>
To: cjb@laptop.org, linux-mmc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Namjae Jeon <linkinjeon@gmail.com>
Subject: [PATCH] mmc : Use wait_for_completion_timeout() instead of wait_for_completion in case of write.
Date: Mon, 19 Sep 2011 00:21:41 +0900 [thread overview]
Message-ID: <1316359301-2263-1-git-send-email-linkinjeon@gmail.com> (raw)
host controller can not rise timeout interrupt in write not read in DMA status.
because host can just know whether card is finish to program to use busy line.
If unstable card is keep holding busy line while writing using DMA.
hang problem happen by wait_for_completion. so I think that mmc driver need some exception to avoid this problem.
I suggest to use wait_for_completion_timeout instead of wait_for_completion.
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
---
drivers/mmc/core/core.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 557856b..0fe83d3 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -253,7 +253,20 @@ static void __mmc_start_req(struct mmc_host *host, struct mmc_request *mrq)
static void mmc_wait_for_req_done(struct mmc_host *host,
struct mmc_request *mrq)
{
- wait_for_completion(&mrq->completion);
+ unsigned int timeout_us;
+
+ if ((mrq->data != NULL) && (mrq->data->flags & MMC_DATA_WRITE)) {
+ timeout_us = mrq->data->timeout_ns / 1000;
+ if (mmc_host_clk_rate(host))
+ timeout_us += mrq->data->timeout_clks * 1000 /
+ (mmc_host_clk_rate(host) / 1000);
+ if (!timeout_us)
+ timeout_us = 1000000;
+ if (!wait_for_completion_timeout(&mrq->completion,
+ usecs_to_jiffies(timeout_us)))
+ mrq->cmd->error = -ETIMEDOUT;
+ } else
+ wait_for_completion(&mrq->completion);
}
/**
--
1.7.4.4
next reply other threads:[~2011-09-18 15:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-18 15:21 Namjae Jeon [this message]
2011-09-20 7:39 ` [PATCH] mmc : Use wait_for_completion_timeout() instead of wait_for_completion in case of write Ulf Hansson
2011-09-20 9:28 ` Murali Krishna Palnati
2011-09-20 10:35 ` NamJae Jeon
2011-09-20 10:55 ` Murali Krishna Palnati
2011-09-20 14:22 ` NamJae Jeon
2011-09-20 15:24 ` Murali Krishna Palnati
2011-09-21 0:26 ` NamJae Jeon
2011-09-21 1:14 ` NamJae Jeon
2011-09-21 10:48 ` Linus Walleij
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=1316359301-2263-1-git-send-email-linkinjeon@gmail.com \
--to=linkinjeon@gmail.com \
--cc=cjb@laptop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
/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