From: Grant Grundler <grundler@chromium.org>
To: Chris Ball <cjb@laptop.org>, Ulf Hansson <ulf.hansson@linaro.org>,
Seungwon Jeon <tgih.jun@samsung.com>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Grant Grundler <grundler@chromium.org>
Subject: [PATCH 3/7] mmc: core: restructure error handling for start req
Date: Thu, 26 Sep 2013 12:22:56 -0700 [thread overview]
Message-ID: <1380223380-22451-4-git-send-email-grundler@chromium.org> (raw)
In-Reply-To: <1380223380-22451-1-git-send-email-grundler@chromium.org>
This is an intermediate step to fixing the locking around the
access to host->areq. Reduce the number of "if (saved_areq) vs
"if (areq)" tests in the main code path since I'm going to add
references to "host->lock" in the next patch.
Signed-off-by: Grant Grundler <grundler@chromium.org>
---
drivers/mmc/core/core.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 675139e..4d5de98 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -556,21 +556,20 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host,
mmc_start_bkops(host->card, true);
}
- if (!saved_err && areq)
+ /* Don't start something new if previous one failed. */
+ if (!saved_err && areq) {
start_err = __mmc_start_data_req(host, areq->mrq);
+ /* Cancel a prepared request if it was not started. */
+ if (start_err) {
+ mmc_post_req(host, areq->mrq, -EINVAL);
+ host->areq = NULL;
+ } else
+ host->areq = areq;
+ }
if (saved_areq)
mmc_post_req(host, saved_areq->mrq, 0);
- /* Cancel a prepared request if it was not started. */
- if ((saved_err || start_err) && areq)
- mmc_post_req(host, areq->mrq, -EINVAL);
-
- if (saved_err)
- host->areq = NULL;
- else
- host->areq = areq;
-
if (error)
*error = saved_err;
return saved_areq;
--
1.8.4
next prev parent reply other threads:[~2013-09-26 19:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-26 19:22 [PATCH 0/7] mmc: core: cleanup and locking patches description Grant Grundler
2013-09-26 19:22 ` [PATCH 1/7] mmc: core: rename "data" to saved_areq Grant Grundler
2013-09-26 19:22 ` [PATCH 2/7] mmc: core: rename local var err to saved_err Grant Grundler
2013-09-26 19:22 ` Grant Grundler [this message]
2013-09-26 19:22 ` [PATCH 4/7] mmc: core: use common code path to return error Grant Grundler
2013-09-26 19:22 ` [PATCH 5/7] mmc: core: handling polling more gracefully Grant Grundler
2013-09-26 19:22 ` [PATCH 6/7] mmc: core: protect references to host->areq with host->lock Grant Grundler
2013-10-09 0:48 ` Grant Grundler
2013-10-09 9:07 ` Ulf Hansson
2013-09-26 19:23 ` [PATCH 7/7] mmc: core: mmc_start_req is a misnomer -> mmc_process_areq Grant Grundler
2013-09-26 19:57 ` [PATCH 0/7] mmc: core: cleanup and locking patches description Grant Grundler
2013-10-03 20:35 ` Grant Grundler
[not found] ` <CAPDyKFqZHkDAKoaRM1vrUXCMVsAZBEs-PanjyoR=E=Lrp1aU7Q@mail.gmail.com>
2013-10-03 23:48 ` Grant Grundler
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=1380223380-22451-4-git-send-email-grundler@chromium.org \
--to=grundler@chromium.org \
--cc=cjb@laptop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=tgih.jun@samsung.com \
--cc=ulf.hansson@linaro.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).