[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220901123630.1098433-1-david@protonic.nl>
Date:   Thu,  1 Sep 2022 14:36:30 +0200
From:   David Jander <david@...tonic.nl>
To:     linux-spi@...r.kernel.org, Mark Brown <broonie@...nel.org>
Cc:     linux-kernel@...r.kernel.org,
        Vincent Whitchurch <vincent.whitchurch@...s.com>,
        Casper Andersson <casper.casan@...il.com>,
        David Jander <david@...tonic.nl>
Subject: [PATCH] spi: spi.c: Fix queue hang if previous transfer failed
The queue worker always needs to be kicked one final time after a transfer
is done in order to transition to idle (ctlr->busy = false).
Commit 69fa95905d40 ("spi: Ensure the io_mutex is held until
spi_finalize_current_message()") moved this code into
__spi_pump_messages(), but it was executed only if the transfer was
successful. This condition check causes ctlr-busy to stay true in case of
a failed transfer.
This in turn causes that no new work is ever scheduled to the work queue.
Fixes: 69fa95905d40 ("spi: Ensure the io_mutex is held until spi_finalize_current_message()")
Reported-by: Vincent Whitchurch <vincent.whitchurch@...s.com>
Signed-off-by: David Jander <david@...tonic.nl>
---
 drivers/spi/spi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 83da8862b8f2..7355f4ac4e33 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1727,8 +1727,7 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
 	spin_unlock_irqrestore(&ctlr->queue_lock, flags);
 
 	ret = __spi_pump_transfer_message(ctlr, msg, was_busy);
-	if (!ret)
-		kthread_queue_work(ctlr->kworker, &ctlr->pump_messages);
+	kthread_queue_work(ctlr->kworker, &ctlr->pump_messages);
 
 	ctlr->cur_msg = NULL;
 	ctlr->fallback = false;
-- 
2.34.1
Powered by blists - more mailing lists
 
