Commit f34bdd2f authored by Adrian Hunter's avatar Adrian Hunter Committed by Ulf Hansson

mmc: core: Factor out mrq preparation from mmc_start_request()

In preparation to reuse the code for CQE support.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 4b67e63f
...@@ -292,23 +292,18 @@ static void mmc_mrq_pr_debug(struct mmc_host *host, struct mmc_request *mrq) ...@@ -292,23 +292,18 @@ static void mmc_mrq_pr_debug(struct mmc_host *host, struct mmc_request *mrq)
} }
} }
static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) static int mmc_mrq_prep(struct mmc_host *host, struct mmc_request *mrq)
{ {
#ifdef CONFIG_MMC_DEBUG #ifdef CONFIG_MMC_DEBUG
unsigned int i, sz; unsigned int i, sz;
struct scatterlist *sg; struct scatterlist *sg;
#endif #endif
mmc_retune_hold(host);
if (mmc_card_removed(host->card))
return -ENOMEDIUM;
mmc_mrq_pr_debug(host, mrq);
WARN_ON(!host->claimed);
if (mrq->cmd) {
mrq->cmd->error = 0; mrq->cmd->error = 0;
mrq->cmd->mrq = mrq; mrq->cmd->mrq = mrq;
mrq->cmd->data = mrq->data;
}
if (mrq->sbc) { if (mrq->sbc) {
mrq->sbc->error = 0; mrq->sbc->error = 0;
mrq->sbc->mrq = mrq; mrq->sbc->mrq = mrq;
...@@ -325,8 +320,6 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) ...@@ -325,8 +320,6 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
if (sz != mrq->data->blocks * mrq->data->blksz) if (sz != mrq->data->blocks * mrq->data->blksz)
return -EINVAL; return -EINVAL;
#endif #endif
mrq->cmd->data = mrq->data;
mrq->data->error = 0; mrq->data->error = 0;
mrq->data->mrq = mrq; mrq->data->mrq = mrq;
if (mrq->stop) { if (mrq->stop) {
...@@ -335,6 +328,27 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) ...@@ -335,6 +328,27 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
mrq->stop->mrq = mrq; mrq->stop->mrq = mrq;
} }
} }
return 0;
}
static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
{
int err;
mmc_retune_hold(host);
if (mmc_card_removed(host->card))
return -ENOMEDIUM;
mmc_mrq_pr_debug(host, mrq);
WARN_ON(!host->claimed);
err = mmc_mrq_prep(host, mrq);
if (err)
return err;
led_trigger_event(host->led, LED_FULL); led_trigger_event(host->led, LED_FULL);
__mmc_start_request(host, mrq); __mmc_start_request(host, mrq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment