diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2016-06-29 16:24:22 +0300 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2016-07-25 11:34:37 +0300 |
commit | e0a5640a9996bd9afef81dcdc62a82e59321a96f (patch) | |
tree | 5698fe9d457d061e8597acd9bf79e486ca2f735d /drivers/mmc/host | |
parent | 64ed8dd46ba69a7f03f9019758ef35604f0cdb04 (diff) | |
download | linux-e0a5640a9996bd9afef81dcdc62a82e59321a96f.tar.xz |
mmc: sdhci: Simplify sdhci_finish_command() by clearing host->cmd at the start
sdhci_finish_command() is going to set host->cmd to NULL. Simplify the
code by using a local variable to hold host->cmd and set host->cmd to
NULL at the start.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index f4d6c0460818..a00cdd7fa651 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1054,21 +1054,24 @@ EXPORT_SYMBOL_GPL(sdhci_send_command); static void sdhci_finish_command(struct sdhci_host *host) { + struct mmc_command *cmd = host->cmd; int i; - if (host->cmd->flags & MMC_RSP_PRESENT) { - if (host->cmd->flags & MMC_RSP_136) { + host->cmd = NULL; + + if (cmd->flags & MMC_RSP_PRESENT) { + if (cmd->flags & MMC_RSP_136) { /* CRC is stripped so we need to do some shifting. */ for (i = 0;i < 4;i++) { - host->cmd->resp[i] = sdhci_readl(host, + cmd->resp[i] = sdhci_readl(host, SDHCI_RESPONSE + (3-i)*4) << 8; if (i != 3) - host->cmd->resp[i] |= + cmd->resp[i] |= sdhci_readb(host, SDHCI_RESPONSE + (3-i)*4-1); } } else { - host->cmd->resp[0] = sdhci_readl(host, SDHCI_RESPONSE); + cmd->resp[0] = sdhci_readl(host, SDHCI_RESPONSE); } } @@ -1082,21 +1085,19 @@ static void sdhci_finish_command(struct sdhci_host *host) * feature so there might be some problems with older * controllers. */ - if (host->cmd->flags & MMC_RSP_BUSY) { - if (host->cmd->data) { + if (cmd->flags & MMC_RSP_BUSY) { + if (cmd->data) { DBG("Cannot wait for busy signal when also doing a data transfer"); } else if (!(host->quirks & SDHCI_QUIRK_NO_BUSY_IRQ) && !host->busy_handle) { /* Mark that command complete before busy is ended */ host->busy_handle = 1; - host->cmd = NULL; return; } } /* Finished CMD23, now send actual command. */ - if (host->cmd == host->mrq->sbc) { - host->cmd = NULL; + if (cmd == host->mrq->sbc) { sdhci_send_command(host, host->mrq->cmd); } else { @@ -1104,10 +1105,8 @@ static void sdhci_finish_command(struct sdhci_host *host) if (host->data && host->data_early) sdhci_finish_data(host); - if (!host->cmd->data) + if (!cmd->data) tasklet_schedule(&host->finish_tasklet); - - host->cmd = NULL; } } |