Applied "spi: Add an helper to flush the message queue" to the spi tree
broonie at kernel.org
Mon Apr 23 11:05:27 PDT 2018
spi: Add an helper to flush the message queue
has been applied to the spi tree at
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
>From 988f259b46646934003ff8ae4966f7233691d1ad Mon Sep 17 00:00:00 2001
From: Boris Brezillon <boris.brezillon at bootlin.com>
Date: Sun, 22 Apr 2018 20:35:15 +0200
Subject: [PATCH] spi: Add an helper to flush the message queue
This is needed by the spi-mem logic to force all messages that have been
queued before a memory operation to be sent before we start the memory
operation. We do that in order to guarantee that spi-mem operations do
not preempt regular SPI transfers.
Signed-off-by: Boris Brezillon <boris.brezillon at bootlin.com>
Signed-off-by: Mark Brown <broonie at kernel.org>
drivers/spi/internals.h | 2 ++
drivers/spi/spi.c | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/drivers/spi/internals.h b/drivers/spi/internals.h
index dbe56c77b464..4a28a8395552 100644
@@ -17,6 +17,8 @@
+void spi_flush_queue(struct spi_controller *ctrl);
int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
struct sg_table *sgt, void *buf, size_t len,
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 86b778d8563e..3f4666365678 100644
@@ -1522,6 +1522,22 @@ static int spi_controller_initialize_queue(struct spi_controller *ctlr)
+ * spi_flush_queue - Send all pending messages in the queue from the callers'
+ * context
+ * @ctlr: controller to process queue for
+ * This should be used when one wants to ensure all pending messages have been
+ * sent before doing something. Is used by the spi-mem code to make sure SPI
+ * memory operations do not preempt regular SPI transfers that have been queued
+ * before the spi-mem operation.
+void spi_flush_queue(struct spi_controller *ctlr)
+ if (ctlr->transfer == spi_queued_transfer)
+ __spi_pump_messages(ctlr, false);
More information about the linux-mtd