diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:15:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:15:21 +0000 |
commit | 1c1ddb052494b49a5dd1ab77294028c885753b28 (patch) | |
tree | fedf735083e230160517562a3dceba48a0b1418d /drivers/spi/spi.c | |
parent | Releasing progress-linux version 6.9.9-1~progress7.99u1. (diff) | |
download | linux-1c1ddb052494b49a5dd1ab77294028c885753b28.tar.xz linux-1c1ddb052494b49a5dd1ab77294028c885753b28.zip |
Merging upstream version 6.9.10.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index c349d60126..9304fd03bf 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2137,7 +2137,8 @@ static void __spi_unoptimize_message(struct spi_message *msg) */ static void spi_maybe_unoptimize_message(struct spi_message *msg) { - if (!msg->pre_optimized && msg->optimized) + if (!msg->pre_optimized && msg->optimized && + !msg->spi->controller->defer_optimize_message) __spi_unoptimize_message(msg); } @@ -4285,6 +4286,11 @@ static int __spi_optimize_message(struct spi_device *spi, static int spi_maybe_optimize_message(struct spi_device *spi, struct spi_message *msg) { + if (spi->controller->defer_optimize_message) { + msg->spi = spi; + return 0; + } + if (msg->pre_optimized) return 0; @@ -4315,6 +4321,13 @@ int spi_optimize_message(struct spi_device *spi, struct spi_message *msg) { int ret; + /* + * Pre-optimization is not supported and optimization is deferred e.g. + * when using spi-mux. + */ + if (spi->controller->defer_optimize_message) + return 0; + ret = __spi_optimize_message(spi, msg); if (ret) return ret; @@ -4341,6 +4354,9 @@ EXPORT_SYMBOL_GPL(spi_optimize_message); */ void spi_unoptimize_message(struct spi_message *msg) { + if (msg->spi->controller->defer_optimize_message) + return; + __spi_unoptimize_message(msg); msg->pre_optimized = false; } @@ -4423,8 +4439,6 @@ int spi_async(struct spi_device *spi, struct spi_message *message) spin_unlock_irqrestore(&ctlr->bus_lock_spinlock, flags); - spi_maybe_unoptimize_message(message); - return ret; } EXPORT_SYMBOL_GPL(spi_async); |