Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1723323
| From | Ulf Hansson <ulf.hansson@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/5] mmc: sdhci: Tidy reading 136-bit responses |
| Date | 2017-08-30 15:20 +0200 |
| Message-ID | <ukb4u-li-27@gated-at.bofh.it> (permalink) |
| References | <ugPDc-1pc-23@gated-at.bofh.it> <ugPDc-1pc-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 21 August 2017 at 09:41, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> From: Adrian Hunter <adrian.hunter@intel.com>
>
> Read each register only once and move the code to a separate function so
> that it is not jammed against the 80 column margin.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Thanks, applied for next!
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci.c | 28 ++++++++++++++++++----------
> 1 file changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index a1ad2ddadca1..ba639b7851cb 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1173,24 +1173,32 @@ void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
> }
> EXPORT_SYMBOL_GPL(sdhci_send_command);
>
> +static void sdhci_read_rsp_136(struct sdhci_host *host, struct mmc_command *cmd)
> +{
> + int i, reg;
> +
> + for (i = 0; i < 4; i++) {
> + reg = SDHCI_RESPONSE + (3 - i) * 4;
> + cmd->resp[i] = sdhci_readl(host, reg);
> + }
> +
> + /* CRC is stripped so we need to do some shifting */
> + for (i = 0; i < 4; i++) {
> + cmd->resp[i] <<= 8;
> + if (i != 3)
> + cmd->resp[i] |= cmd->resp[i + 1] >> 24;
> + }
> +}
> +
> static void sdhci_finish_command(struct sdhci_host *host)
> {
> struct mmc_command *cmd = host->cmd;
> - int i;
>
> 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++) {
> - cmd->resp[i] = sdhci_readl(host,
> - SDHCI_RESPONSE + (3-i)*4) << 8;
> - if (i != 3)
> - cmd->resp[i] |=
> - sdhci_readb(host,
> - SDHCI_RESPONSE + (3-i)*4-1);
> - }
> + sdhci_read_rsp_136(host, cmd);
> } else {
> cmd->resp[0] = sdhci_readl(host, SDHCI_RESPONSE);
> }
> --
> 2.11.0
>
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH 1/5] mmc: sdhci: Tidy reading 136-bit responses Ulf Hansson <ulf.hansson@linaro.org> - 2017-08-30 15:20 +0200
csiph-web