diff mbox series

[v1,1/2] spi: Revert "Check if transfer is mapped before calling DMA sync APIs"

Message ID 20240531094658.1598969-2-andy.shevchenko@gmail.com
State New
Headers show
Series spi: Make dummy SG handling robust | expand

Commit Message

Andy Shevchenko May 31, 2024, 9:44 a.m. UTC
This reverts commit da560097c05612f8d360f86528f6213629b9c395.

It makes no difference as it was mistakenly thought that it fixes
a bug while another unnoticed change have been preserved in the
tester's repositorory.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/spi/spi.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 9bc9fd10d538..43cd3e5bccbe 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1320,7 +1320,7 @@  static int __spi_unmap_msg(struct spi_controller *ctlr, struct spi_message *msg)
 	return 0;
 }
 
-static void spi_dma_sync_for_device(struct spi_controller *ctlr, struct spi_message *msg,
+static void spi_dma_sync_for_device(struct spi_controller *ctlr,
 				    struct spi_transfer *xfer)
 {
 	struct device *rx_dev = ctlr->cur_rx_dma_dev;
@@ -1329,14 +1329,11 @@  static void spi_dma_sync_for_device(struct spi_controller *ctlr, struct spi_mess
 	if (!ctlr->cur_msg_mapped)
 		return;
 
-	if (!ctlr->can_dma(ctlr, msg->spi, xfer))
-		return;
-
 	dma_sync_sgtable_for_device(tx_dev, &xfer->tx_sg, DMA_TO_DEVICE);
 	dma_sync_sgtable_for_device(rx_dev, &xfer->rx_sg, DMA_FROM_DEVICE);
 }
 
-static void spi_dma_sync_for_cpu(struct spi_controller *ctlr, struct spi_message *msg,
+static void spi_dma_sync_for_cpu(struct spi_controller *ctlr,
 				 struct spi_transfer *xfer)
 {
 	struct device *rx_dev = ctlr->cur_rx_dma_dev;
@@ -1345,9 +1342,6 @@  static void spi_dma_sync_for_cpu(struct spi_controller *ctlr, struct spi_message
 	if (!ctlr->cur_msg_mapped)
 		return;
 
-	if (!ctlr->can_dma(ctlr, msg->spi, xfer))
-		return;
-
 	dma_sync_sgtable_for_cpu(rx_dev, &xfer->rx_sg, DMA_FROM_DEVICE);
 	dma_sync_sgtable_for_cpu(tx_dev, &xfer->tx_sg, DMA_TO_DEVICE);
 }
@@ -1365,13 +1359,11 @@  static inline int __spi_unmap_msg(struct spi_controller *ctlr,
 }
 
 static void spi_dma_sync_for_device(struct spi_controller *ctrl,
-				    struct spi_message *msg,
 				    struct spi_transfer *xfer)
 {
 }
 
 static void spi_dma_sync_for_cpu(struct spi_controller *ctrl,
-				 struct spi_message *msg,
 				 struct spi_transfer *xfer)
 {
 }
@@ -1643,10 +1635,10 @@  static int spi_transfer_one_message(struct spi_controller *ctlr,
 			reinit_completion(&ctlr->xfer_completion);
 
 fallback_pio:
-			spi_dma_sync_for_device(ctlr, msg, xfer);
+			spi_dma_sync_for_device(ctlr, xfer);
 			ret = ctlr->transfer_one(ctlr, msg->spi, xfer);
 			if (ret < 0) {
-				spi_dma_sync_for_cpu(ctlr, msg, xfer);
+				spi_dma_sync_for_cpu(ctlr, xfer);
 
 				if (ctlr->cur_msg_mapped &&
 				   (xfer->error & SPI_TRANS_FAIL_NO_START)) {
@@ -1671,7 +1663,7 @@  static int spi_transfer_one_message(struct spi_controller *ctlr,
 					msg->status = ret;
 			}
 
-			spi_dma_sync_for_cpu(ctlr, msg, xfer);
+			spi_dma_sync_for_cpu(ctlr, xfer);
 		} else {
 			if (xfer->len)
 				dev_err(&msg->spi->dev,