diff options
author | David Jander <david@protonic.nl> | 2022-06-21 08:12:24 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-06-27 13:27:16 +0100 |
commit | 1714582a3a087eda8786d5a1b32b2ec86ca8a303 (patch) | |
tree | 0d8faca526aa19d37bbf338dc5174258a94cc993 /drivers/spi/spi.c | |
parent | 40308f9642a85c30fa7cc5ab8672020cb96ecb66 (diff) | |
download | linux-1714582a3a087eda8786d5a1b32b2ec86ca8a303.tar.gz linux-1714582a3a087eda8786d5a1b32b2ec86ca8a303.tar.bz2 linux-1714582a3a087eda8786d5a1b32b2ec86ca8a303.zip |
spi: Move ctlr->cur_msg_prepared to struct spi_message
This enables the possibility to transfer a message that is not at the
current tip of the async message queue.
This is in preparation of the next patch(es) which enable spi_sync messages
to skip the queue altogether.
Signed-off-by: David Jander <david@protonic.nl>
Link: https://lore.kernel.org/r/20220621061234.3626638-2-david@protonic.nl
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index c78d1ceeaa42..eb6360153fa1 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1684,7 +1684,7 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread) spi_finalize_current_message(ctlr); goto out; } - ctlr->cur_msg_prepared = true; + msg->prepared = true; } ret = spi_map_msg(ctlr, msg); @@ -1926,7 +1926,7 @@ void spi_finalize_current_message(struct spi_controller *ctlr) */ spi_res_release(ctlr, mesg); - if (ctlr->cur_msg_prepared && ctlr->unprepare_message) { + if (mesg->prepared && ctlr->unprepare_message) { ret = ctlr->unprepare_message(ctlr, mesg); if (ret) { dev_err(&ctlr->dev, "failed to unprepare message: %d\n", @@ -1934,9 +1934,10 @@ void spi_finalize_current_message(struct spi_controller *ctlr) } } + mesg->prepared = false; + spin_lock_irqsave(&ctlr->queue_lock, flags); ctlr->cur_msg = NULL; - ctlr->cur_msg_prepared = false; ctlr->fallback = false; kthread_queue_work(ctlr->kworker, &ctlr->pump_messages); spin_unlock_irqrestore(&ctlr->queue_lock, flags); |