[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPDyKFrHqZxafeP=HMnKTHKWk4f-eC59aViVP=Lu71La_aYD1g@mail.gmail.com>
Date: Thu, 9 Dec 2021 11:05:25 +0100
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/2] mmc: mmc_spi: Use write_or_read temporary variable
in mmc_spi_data_do()
On Mon, 6 Dec 2021 at 12:52, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> Use write_or_read temporary variable in mmc_spi_data_do() to deduplicate
> the conditional code.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/mmc_spi.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
> index 4b0f9035ad29..a576181e9db0 100644
> --- a/drivers/mmc/host/mmc_spi.c
> +++ b/drivers/mmc/host/mmc_spi.c
> @@ -859,14 +859,14 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
> struct spi_device *spi = host->spi;
> struct device *dma_dev = host->dma_dev;
> struct spi_transfer *t;
> - enum dma_data_direction direction;
> + enum dma_data_direction direction = mmc_get_dma_dir(data);
> struct scatterlist *sg;
> unsigned n_sg;
> bool multiple = (data->blocks > 1);
> + const char *write_or_read = (direction == DMA_TO_DEVICE) ? "write" : "read";
> u32 clock_rate;
> unsigned long timeout;
>
> - direction = mmc_get_dma_dir(data);
> mmc_spi_setup_data_message(host, multiple, direction);
> t = &host->t;
>
> @@ -921,9 +921,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
> while (length) {
> t->len = min(length, blk_size);
>
> - dev_dbg(&host->spi->dev, " %s block, %d bytes\n",
> - (direction == DMA_TO_DEVICE) ? "write" : "read",
> - t->len);
> + dev_dbg(&spi->dev, " %s block, %d bytes\n", write_or_read, t->len);
>
> if (direction == DMA_TO_DEVICE)
> status = mmc_spi_writeblock(host, t, timeout);
> @@ -948,9 +946,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
>
> if (status < 0) {
> data->error = status;
> - dev_dbg(&spi->dev, "%s status %d\n",
> - (direction == DMA_TO_DEVICE) ? "write" : "read",
> - status);
> + dev_dbg(&spi->dev, "%s status %d\n", write_or_read, status);
> break;
> }
> }
> --
> 2.33.0
>
Powered by blists - more mailing lists