public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>, Chris Ball <chris@printf.net>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
	Aaron Lu <aaron.lu@intel.com>, Philip Rakity <prakity@nvidia.com>,
	Girish K S <girish.shivananjappa@linaro.org>,
	Al Cooper <alcooperx@gmail.com>,
	Arend van Spriel <arend@broadcom.com>
Subject: [PATCH 04/13] mmc: core: Move mmc_card_removed() into mmc_start_request()
Date: Fri,  5 Dec 2014 19:41:02 +0200	[thread overview]
Message-ID: <1417801271-15575-5-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1417801271-15575-1-git-send-email-adrian.hunter@intel.com>

Both callers of mmc_start_request() call mmc_card_removed()
so move that call into mmc_start_request().

This patch is preparation for adding re-tuning support.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/core/core.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index fcde4da..884f35a 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -185,13 +185,14 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
 
 EXPORT_SYMBOL(mmc_request_done);
 
-static void
-mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
+static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 {
 #ifdef CONFIG_MMC_DEBUG
 	unsigned int i, sz;
 	struct scatterlist *sg;
 #endif
+	if (mmc_card_removed(host->card))
+		return -ENOMEDIUM;
 
 	if (mrq->sbc) {
 		pr_debug("<%s: starting CMD%u arg %08x flags %08x>\n",
@@ -251,6 +252,8 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 	mmc_host_clk_hold(host);
 	led_trigger_event(host->led, LED_FULL);
 	host->ops->request(host, mrq);
+
+	return 0;
 }
 
 /**
@@ -345,29 +348,34 @@ static void mmc_wait_done(struct mmc_request *mrq)
  */
 static int __mmc_start_data_req(struct mmc_host *host, struct mmc_request *mrq)
 {
+	int err;
+
 	mrq->done = mmc_wait_data_done;
 	mrq->host = host;
-	if (mmc_card_removed(host->card)) {
-		mrq->cmd->error = -ENOMEDIUM;
+
+	err = mmc_start_request(host, mrq);
+	if (err) {
+		mrq->cmd->error = err;
 		mmc_wait_data_done(mrq);
-		return -ENOMEDIUM;
 	}
-	mmc_start_request(host, mrq);
 
-	return 0;
+	return err;
 }
 
 static int __mmc_start_req(struct mmc_host *host, struct mmc_request *mrq)
 {
+	int err;
+
 	init_completion(&mrq->completion);
 	mrq->done = mmc_wait_done;
-	if (mmc_card_removed(host->card)) {
-		mrq->cmd->error = -ENOMEDIUM;
+
+	err = mmc_start_request(host, mrq);
+	if (err) {
+		mrq->cmd->error = err;
 		complete(&mrq->completion);
-		return -ENOMEDIUM;
 	}
-	mmc_start_request(host, mrq);
-	return 0;
+
+	return err;
 }
 
 /*
-- 
1.9.1


  parent reply	other threads:[~2014-12-05 17:43 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-05 17:40 [RFC PATCH 00/13] mmc: host: Add facility to support re-tuning Adrian Hunter
2014-12-05 17:40 ` [PATCH 01/13] mmc: core: Simplify by adding mmc_execute_tuning() Adrian Hunter
2015-01-13 11:19   ` Ulf Hansson
2014-12-05 17:41 ` [PATCH 02/13] mmc: host: Add facility to support re-tuning Adrian Hunter
2015-01-13 11:25   ` Ulf Hansson
2015-01-13 13:23     ` Adrian Hunter
2015-01-13 14:22       ` Ulf Hansson
2015-01-13 14:36         ` Adrian Hunter
2015-01-13 14:56           ` Ulf Hansson
2015-01-13 15:11             ` Arend van Spriel
2015-01-13 15:41               ` Ulf Hansson
2015-01-13 16:02                 ` Arend van Spriel
2015-01-14  9:47                   ` Ulf Hansson
2015-01-14  9:57                     ` Adrian Hunter
2015-01-14 10:13                       ` Ulf Hansson
2015-01-14 12:24                         ` Adrian Hunter
2015-01-14 12:59                           ` Ulf Hansson
2015-01-15 10:17                             ` Adrian Hunter
2015-01-15 13:39                               ` Ulf Hansson
2015-01-15 14:07                                 ` Arend van Spriel
2015-01-15 14:17                                   ` Arend van Spriel
2015-01-15 14:46                                     ` Ulf Hansson
2015-01-15 14:59                                       ` Arend van Spriel
2015-01-19  9:27                                         ` Ulf Hansson
2015-01-19  9:56                                           ` Adrian Hunter
2015-01-14 12:38                         ` Arend van Spriel
2015-01-14 12:52                           ` Ulf Hansson
2015-01-13 15:04         ` Arend van Spriel
2014-12-05 17:41 ` [PATCH 03/13] mmc: core: Disable re-tuning when card is no longer initialized Adrian Hunter
2014-12-05 17:41 ` Adrian Hunter [this message]
2015-01-13 11:20   ` [PATCH 04/13] mmc: core: Move mmc_card_removed() into mmc_start_request() Ulf Hansson
2014-12-05 17:41 ` [PATCH 05/13] mmc: core: Add support for re-tuning before each request Adrian Hunter
2014-12-05 17:41 ` [PATCH 06/13] mmc: core: Check re-tuning before retrying Adrian Hunter
2014-12-05 17:41 ` [PATCH 07/13] mmc: core: Hold re-tuning during switch commands Adrian Hunter
2014-12-05 17:41 ` [PATCH 08/13] mmc: core: Hold re-tuning during erase commands Adrian Hunter
2014-12-05 17:41 ` [PATCH 09/13] mmc: core: Hold re-tuning while bkops ongoing Adrian Hunter
2014-12-05 17:41 ` [PATCH 10/13] mmc: mmc: Comment that callers need to hold re-tuning if the card is put to sleep Adrian Hunter
2014-12-05 17:41 ` [PATCH 11/13] mmc: core: Add support for HS400 re-tuning Adrian Hunter
2014-12-05 17:41 ` [PATCH 12/13] mmc: sdhci: Always init buf_ready_int Adrian Hunter
2015-01-13 11:21   ` Ulf Hansson
2014-12-05 17:41 ` [PATCH 13/13] mmc: sdhci: Change to new way of doing re-tuning Adrian Hunter
2014-12-19 14:07 ` [RFC PATCH 00/13] mmc: host: Add facility to support re-tuning Adrian Hunter
2014-12-19 14:37   ` Ulf Hansson
2015-01-12 13:05   ` Adrian Hunter
2015-01-13 11:27 ` Ulf Hansson

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=1417801271-15575-5-git-send-email-adrian.hunter@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=aaron.lu@intel.com \
    --cc=alcooperx@gmail.com \
    --cc=arend@broadcom.com \
    --cc=chris@printf.net \
    --cc=girish.shivananjappa@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=prakity@nvidia.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