linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] spi: atmel: Do not cancel a transfer upon any signal
@ 2023-11-27  9:58 Miquel Raynal
  2023-11-27  9:58 ` [PATCH 2/2] spi: atmel: Drop unused defines Miquel Raynal
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Miquel Raynal @ 2023-11-27  9:58 UTC (permalink / raw)
  To: Mark Brown, linux-spi
  Cc: Thomas Petazzoni, Ryan Wanner, Miquel Raynal, stable, Ronald Wahl

The intended move from wait_for_completion_*() to
wait_for_completion_interruptible_*() was to allow (very) long spi memory
transfers to be stopped upon user request instead of freezing the
machine forever as the timeout value could now be significantly bigger.

However, depending on the user logic, applications can receive many
signals for their own "internal" purpose and have nothing to do with the
requested kernel operations, hence interrupting spi transfers upon any
signal is probably not a wise choice. Instead, let's switch to
wait_for_completion_killable_*() to only catch the "important"
signals. This was likely the intended behavior anyway.

Fixes: e0205d6203c2 ("spi: atmel: Prevent false timeouts on long transfers")
Cc: stable@vger.kernel.org
Reported-by: Ronald Wahl <ronald.wahl@raritan.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
Hello Ronald, this is only compile tested, please let me know if that
fixes your use case or if you still suffer from interrupted transfers.
Thanks!
---
 drivers/spi/spi-atmel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 6aa8adbe4170..2e8860865af9 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1336,8 +1336,8 @@ static int atmel_spi_one_transfer(struct spi_controller *host,
 		}
 
 		dma_timeout = msecs_to_jiffies(spi_controller_xfer_timeout(host, xfer));
-		ret_timeout = wait_for_completion_interruptible_timeout(&as->xfer_completion,
-									dma_timeout);
+		ret_timeout = wait_for_completion_killable_timeout(&as->xfer_completion,
+								   dma_timeout);
 		if (ret_timeout <= 0) {
 			dev_err(&spi->dev, "spi transfer %s\n",
 				!ret_timeout ? "timeout" : "canceled");
-- 
2.34.1


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

end of thread, other threads:[~2023-12-05  7:49 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-27  9:58 [PATCH 1/2] spi: atmel: Do not cancel a transfer upon any signal Miquel Raynal
2023-11-27  9:58 ` [PATCH 2/2] spi: atmel: Drop unused defines Miquel Raynal
2023-11-27 15:10 ` [PATCH 1/2] spi: atmel: Do not cancel a transfer upon any signal Ronald Wahl
2023-11-27 17:54   ` Ronald Wahl
2023-11-29  8:49     ` Miquel Raynal
2023-11-29 11:05       ` Ronald Wahl
2023-11-30 12:46       ` Richard Weinberger
2023-11-30 18:26         ` Richard Weinberger
2023-11-30 18:36           ` Ronald Wahl
2023-11-30 20:15           ` Miquel Raynal
2023-11-30 20:43             ` Ronald Wahl
2023-11-30 20:58               ` Richard Weinberger
2023-12-01 11:13               ` David Laight
2023-12-01 13:38                 ` Ronald Wahl
2023-12-04 11:54                   ` Ronald Wahl
2023-12-04 12:26                     ` Mark Brown
2023-12-04 12:39                       ` Ronald Wahl
2023-12-04 12:19                   ` David Laight
2023-12-05  7:49               ` Miquel Raynal
2023-11-27 16:48 ` Mark Brown
2023-12-01 14:16 ` Mark Brown
2023-12-04 15:47 ` 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).