linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] mmc: mmc_spi: Convert 'multiple' to be boolean in mmc_spi_data_do()
@ 2021-12-06 11:52 Andy Shevchenko
  2021-12-06 11:52 ` [PATCH v1 2/2] mmc: mmc_spi: Use write_or_read temporary variable " Andy Shevchenko
  2021-12-09 10:05 ` [PATCH v1 1/2] mmc: mmc_spi: Convert 'multiple' to be boolean " Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-12-06 11:52 UTC (permalink / raw)
  To: Andy Shevchenko, linux-mmc, linux-kernel; +Cc: Ulf Hansson

Convert 'multiple' to be boolean in mmc_spi_data_do() since
it's initially being used as boolean.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/host/mmc_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index b431cdd27353..4b0f9035ad29 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -547,7 +547,7 @@ mmc_spi_command_send(struct mmc_spi_host *host,
 static void
 mmc_spi_setup_data_message(
 	struct mmc_spi_host	*host,
-	int			multiple,
+	bool			multiple,
 	enum dma_data_direction	direction)
 {
 	struct spi_transfer	*t;
@@ -862,7 +862,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
 	enum dma_data_direction	direction;
 	struct scatterlist	*sg;
 	unsigned		n_sg;
-	int			multiple = (data->blocks > 1);
+	bool			multiple = (data->blocks > 1);
 	u32			clock_rate;
 	unsigned long		timeout;
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v1 2/2] mmc: mmc_spi: Use write_or_read temporary variable in mmc_spi_data_do()
  2021-12-06 11:52 [PATCH v1 1/2] mmc: mmc_spi: Convert 'multiple' to be boolean in mmc_spi_data_do() Andy Shevchenko
@ 2021-12-06 11:52 ` Andy Shevchenko
  2021-12-09 10:05   ` Ulf Hansson
  2021-12-09 10:05 ` [PATCH v1 1/2] mmc: mmc_spi: Convert 'multiple' to be boolean " Ulf Hansson
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2021-12-06 11:52 UTC (permalink / raw)
  To: Andy Shevchenko, linux-mmc, linux-kernel; +Cc: Ulf Hansson

Use write_or_read temporary variable in mmc_spi_data_do() to deduplicate
the conditional code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/2] mmc: mmc_spi: Convert 'multiple' to be boolean in mmc_spi_data_do()
  2021-12-06 11:52 [PATCH v1 1/2] mmc: mmc_spi: Convert 'multiple' to be boolean in mmc_spi_data_do() Andy Shevchenko
  2021-12-06 11:52 ` [PATCH v1 2/2] mmc: mmc_spi: Use write_or_read temporary variable " Andy Shevchenko
@ 2021-12-09 10:05 ` Ulf Hansson
  1 sibling, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2021-12-09 10:05 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mmc, linux-kernel

On Mon, 6 Dec 2021 at 12:52, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Convert 'multiple' to be boolean in mmc_spi_data_do() since
> it's initially being used as boolean.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/mmc_spi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
> index b431cdd27353..4b0f9035ad29 100644
> --- a/drivers/mmc/host/mmc_spi.c
> +++ b/drivers/mmc/host/mmc_spi.c
> @@ -547,7 +547,7 @@ mmc_spi_command_send(struct mmc_spi_host *host,
>  static void
>  mmc_spi_setup_data_message(
>         struct mmc_spi_host     *host,
> -       int                     multiple,
> +       bool                    multiple,
>         enum dma_data_direction direction)
>  {
>         struct spi_transfer     *t;
> @@ -862,7 +862,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
>         enum dma_data_direction direction;
>         struct scatterlist      *sg;
>         unsigned                n_sg;
> -       int                     multiple = (data->blocks > 1);
> +       bool                    multiple = (data->blocks > 1);
>         u32                     clock_rate;
>         unsigned long           timeout;
>
> --
> 2.33.0
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 2/2] mmc: mmc_spi: Use write_or_read temporary variable in mmc_spi_data_do()
  2021-12-06 11:52 ` [PATCH v1 2/2] mmc: mmc_spi: Use write_or_read temporary variable " Andy Shevchenko
@ 2021-12-09 10:05   ` Ulf Hansson
  0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2021-12-09 10:05 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mmc, linux-kernel

On Mon, 6 Dec 2021 at 12:52, Andy Shevchenko
<andriy.shevchenko@linux.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@linux.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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-09 10:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 11:52 [PATCH v1 1/2] mmc: mmc_spi: Convert 'multiple' to be boolean in mmc_spi_data_do() Andy Shevchenko
2021-12-06 11:52 ` [PATCH v1 2/2] mmc: mmc_spi: Use write_or_read temporary variable " Andy Shevchenko
2021-12-09 10:05   ` Ulf Hansson
2021-12-09 10:05 ` [PATCH v1 1/2] mmc: mmc_spi: Convert 'multiple' to be boolean " Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).