linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] spi: qcom: geni: set the error code for gpi transfer
@ 2022-01-03  7:11 Vinod Koul
  2022-01-03  7:11 ` [PATCH v2 2/2] spi: qcom: geni: handle timeout for gpi mode Vinod Koul
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vinod Koul @ 2022-01-03  7:11 UTC (permalink / raw)
  To: Bjorn Andersson, Mark Brown
  Cc: linux-arm-msm, Vinod Koul, Douglas Anderson, Matthias Kaehlcke,
	linux-spi, linux-kernel

Before we invoke spi_finalize_current_transfer() in
spi_gsi_callback_result() we should set the spi->cur_msg->status as
appropriate (0 for success, error otherwise).

The helps to return error on transfer and not wait till it timesout on
error

Fixes: b59c122484ec ("spi: spi-geni-qcom: Add support for GPI dma")
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---

Changes in v2:
 - add missing spi_finalize_current_transfer() for dma error case

 drivers/spi/spi-geni-qcom.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
index 413fa1a7a936..b82f3ddff0f4 100644
--- a/drivers/spi/spi-geni-qcom.c
+++ b/drivers/spi/spi-geni-qcom.c
@@ -346,17 +346,21 @@ spi_gsi_callback_result(void *cb, const struct dmaengine_result *result)
 {
 	struct spi_master *spi = cb;
 
+	spi->cur_msg->status = -EIO;
 	if (result->result != DMA_TRANS_NOERROR) {
 		dev_err(&spi->dev, "DMA txn failed: %d\n", result->result);
+		spi_finalize_current_transfer(spi);
 		return;
 	}
 
 	if (!result->residue) {
+		spi->cur_msg->status = 0;
 		dev_dbg(&spi->dev, "DMA txn completed\n");
-		spi_finalize_current_transfer(spi);
 	} else {
 		dev_err(&spi->dev, "DMA xfer has pending: %d\n", result->residue);
 	}
+
+	spi_finalize_current_transfer(spi);
 }
 
 static int setup_gsi_xfer(struct spi_transfer *xfer, struct spi_geni_master *mas,
-- 
2.31.1


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

end of thread, other threads:[~2022-01-06 20:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-03  7:11 [PATCH v2 1/2] spi: qcom: geni: set the error code for gpi transfer Vinod Koul
2022-01-03  7:11 ` [PATCH v2 2/2] spi: qcom: geni: handle timeout for gpi mode Vinod Koul
2022-01-06 16:13 ` [PATCH v2 1/2] spi: qcom: geni: set the error code for gpi transfer Doug Anderson
2022-01-06 20:28 ` Mark Brown

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).