diff mbox

[04/13] mmc: core: Move mmc_card_removed() into mmc_start_request()

Message ID 1417801271-15575-5-git-send-email-adrian.hunter@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Adrian Hunter Dec. 5, 2014, 5:41 p.m. UTC
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(-)

Comments

Ulf Hansson Jan. 13, 2015, 11:20 a.m. UTC | #1
On 5 December 2014 at 18:41, Adrian Hunter <adrian.hunter@intel.com> wrote:
> 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>

Thanks! Applied for next.

Kind regards
Uffe

> ---
>  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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
 }
 
 /*