From: per.forlin@linaro.org (Per Forlin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] mmc: core: clarify how to use post_req in case of errors
Date: Mon, 29 Aug 2011 15:35:58 +0200 [thread overview]
Message-ID: <1314624959-4634-2-git-send-email-per.forlin@linaro.org> (raw)
In-Reply-To: <1314624959-4634-1-git-send-email-per.forlin@linaro.org>
The err condition in post_req() is set to undo a call made
to pre_req() that hasn't been started yet.
The err condition is not set if an MMC request returns error.
Signed-off-by: Per Forlin <per.forlin@linaro.org>
---
drivers/mmc/core/core.c | 6 ++++++
include/linux/mmc/host.h | 3 +++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 91a0a74..542aa06 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -279,8 +279,14 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host,
mmc_wait_for_req_done(host, host->areq->mrq);
err = host->areq->err_check(host->card, host->areq);
if (err) {
+ /* post process the completed failed request */
mmc_post_req(host, host->areq->mrq, 0);
if (areq)
+ /*
+ * Cancel the new prepared request, because
+ * it can't run until the failed
+ * request has been properly handled.
+ */
mmc_post_req(host, areq->mrq, -EINVAL);
host->areq = NULL;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1d09562..7896fb4 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -108,6 +108,9 @@ struct mmc_host_ops {
* It is optional for the host to implement pre_req and post_req in
* order to support double buffering of requests (prepare one
* request while another request is active).
+ * pre_req() must always be followed by a post_req().
+ * To undo a call made to pre_req(), call post_req() with
+ * a nonzero err condition.
*/
void (*post_req)(struct mmc_host *host, struct mmc_request *req,
int err);
--
1.7.4.1
next prev parent reply other threads:[~2011-08-29 13:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-29 13:35 [PATCH 0/2] mmc: clarifications on host.post_req() Per Forlin
2011-08-29 13:35 ` Per Forlin [this message]
2011-09-12 14:05 ` [PATCH 1/2] mmc: core: clarify how to use post_req in case of errors Linus Walleij
2011-08-29 13:35 ` [PATCH 2/2] mmc: mmci: simplify err check in mmci_post_request Per Forlin
2011-09-12 14:06 ` Linus Walleij
2011-09-21 18:30 ` [PATCH 0/2] mmc: clarifications on host.post_req() Chris Ball
2011-09-21 18:43 ` Per Fridén Förlin
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=1314624959-4634-2-git-send-email-per.forlin@linaro.org \
--to=per.forlin@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).