All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: broonie@kernel.org, andi.shyti@kernel.org, semen.protsenko@linaro.org
Cc: krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com,
	linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, andre.draszik@linaro.org,
	peter.griffin@linaro.org, kernel-team@android.com,
	willmcvicker@google.com, Tudor Ambarus <tudor.ambarus@linaro.org>
Subject: [PATCH v5 09/17] spi: s3c64xx: move common code outside if else
Date: Wed,  7 Feb 2024 12:04:23 +0000	[thread overview]
Message-ID: <20240207120431.2766269-10-tudor.ambarus@linaro.org> (raw)
In-Reply-To: <20240207120431.2766269-1-tudor.ambarus@linaro.org>

Move common code outside if else to avoid code duplication.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/spi/spi-s3c64xx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 0b42d28d2019..4ce6cb3b43f6 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -294,20 +294,18 @@ static int prepare_dma(struct s3c64xx_spi_dma_data *dma,
 	if (dma->direction == DMA_DEV_TO_MEM) {
 		sdd = container_of((void *)dma,
 			struct s3c64xx_spi_driver_data, rx_dma);
-		config.direction = dma->direction;
 		config.src_addr = sdd->sfr_start + S3C64XX_SPI_RX_DATA;
 		config.src_addr_width = sdd->cur_bpw / 8;
 		config.src_maxburst = 1;
-		dmaengine_slave_config(dma->ch, &config);
 	} else {
 		sdd = container_of((void *)dma,
 			struct s3c64xx_spi_driver_data, tx_dma);
-		config.direction = dma->direction;
 		config.dst_addr = sdd->sfr_start + S3C64XX_SPI_TX_DATA;
 		config.dst_addr_width = sdd->cur_bpw / 8;
 		config.dst_maxburst = 1;
-		dmaengine_slave_config(dma->ch, &config);
 	}
+	config.direction = dma->direction;
+	dmaengine_slave_config(dma->ch, &config);
 
 	desc = dmaengine_prep_slave_sg(dma->ch, sgt->sgl, sgt->nents,
 				       dma->direction, DMA_PREP_INTERRUPT);
-- 
2.43.0.687.g38aa6559b0-goog


WARNING: multiple messages have this Message-ID (diff)
From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: broonie@kernel.org, andi.shyti@kernel.org, semen.protsenko@linaro.org
Cc: krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com,
	linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, andre.draszik@linaro.org,
	peter.griffin@linaro.org, kernel-team@android.com,
	willmcvicker@google.com, Tudor Ambarus <tudor.ambarus@linaro.org>
Subject: [PATCH v5 09/17] spi: s3c64xx: move common code outside if else
Date: Wed,  7 Feb 2024 12:04:23 +0000	[thread overview]
Message-ID: <20240207120431.2766269-10-tudor.ambarus@linaro.org> (raw)
In-Reply-To: <20240207120431.2766269-1-tudor.ambarus@linaro.org>

Move common code outside if else to avoid code duplication.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/spi/spi-s3c64xx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 0b42d28d2019..4ce6cb3b43f6 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -294,20 +294,18 @@ static int prepare_dma(struct s3c64xx_spi_dma_data *dma,
 	if (dma->direction == DMA_DEV_TO_MEM) {
 		sdd = container_of((void *)dma,
 			struct s3c64xx_spi_driver_data, rx_dma);
-		config.direction = dma->direction;
 		config.src_addr = sdd->sfr_start + S3C64XX_SPI_RX_DATA;
 		config.src_addr_width = sdd->cur_bpw / 8;
 		config.src_maxburst = 1;
-		dmaengine_slave_config(dma->ch, &config);
 	} else {
 		sdd = container_of((void *)dma,
 			struct s3c64xx_spi_driver_data, tx_dma);
-		config.direction = dma->direction;
 		config.dst_addr = sdd->sfr_start + S3C64XX_SPI_TX_DATA;
 		config.dst_addr_width = sdd->cur_bpw / 8;
 		config.dst_maxburst = 1;
-		dmaengine_slave_config(dma->ch, &config);
 	}
+	config.direction = dma->direction;
+	dmaengine_slave_config(dma->ch, &config);
 
 	desc = dmaengine_prep_slave_sg(dma->ch, sgt->sgl, sgt->nents,
 				       dma->direction, DMA_PREP_INTERRUPT);
-- 
2.43.0.687.g38aa6559b0-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2024-02-07 12:04 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 12:04 [PATCH v5 00/17] spi: s3c64xx: straightforward cleanup Tudor Ambarus
2024-02-07 12:04 ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 01/17] spi: s3c64xx: sort headers alphabetically Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 02/17] spi: s3c64xx: explicitly include <linux/io.h> Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 03/17] spi: s3c64xx: explicitly include <linux/bits.h> Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 04/17] spi: s3c64xx: explicitly include <linux/types.h> Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 05/17] spi: s3c64xx: avoid possible negative array index Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 06/17] spi: s3c64xx: fix typo, s/configuartion/configuration Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 07/17] spi: s3c64xx: remove unneeded (void *) casts in of_match_table Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 08/17] spi: s3c64xx: remove else after return Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` Tudor Ambarus [this message]
2024-02-07 12:04   ` [PATCH v5 09/17] spi: s3c64xx: move common code outside if else Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 10/17] spi: s3c64xx: check return code of dmaengine_slave_config() Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 11/17] spi: s3c64xx: propagate the dma_submit_error() error code Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 12/17] spi: s3c64xx: rename prepare_dma() to s3c64xx_prepare_dma() Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 13/17] spi: s3c64xx: return ETIMEDOUT for wait_for_completion_timeout() Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 14/17] spi: s3c64xx: drop blank line between declarations Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 15/17] spi: s3c64xx: downgrade dev_warn to dev_dbg for optional dt props Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 16/17] spi: s3c64xx: remove duplicated definition Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-07 12:04 ` [PATCH v5 17/17] spi: s3c64xx: drop a superfluous bitwise NOT operation Tudor Ambarus
2024-02-07 12:04   ` Tudor Ambarus
2024-02-08 21:21 ` [PATCH v5 00/17] spi: s3c64xx: straightforward cleanup Mark Brown
2024-02-08 21:21   ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240207120431.2766269-10-tudor.ambarus@linaro.org \
    --to=tudor.ambarus@linaro.org \
    --cc=alim.akhtar@samsung.com \
    --cc=andi.shyti@kernel.org \
    --cc=andre.draszik@linaro.org \
    --cc=broonie@kernel.org \
    --cc=kernel-team@android.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=peter.griffin@linaro.org \
    --cc=semen.protsenko@linaro.org \
    --cc=willmcvicker@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.