FAILED: patch "[PATCH] spi: spi-cadence-quadspi: Fix pm runtime unbalance" failed to apply to 6.6-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x b07f349d1864abe29436f45e3047da2bdd476462
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025063006-expose-blandness-ffd5@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From b07f349d1864abe29436f45e3047da2bdd476462 Mon Sep 17 00:00:00 2001
From: Khairul Anuar Romli <[email protected]>
Date: Mon, 16 Jun 2025 09:13:53 +0800
Subject: [PATCH] spi: spi-cadence-quadspi: Fix pm runtime unbalance
Having PM put sync in remove function is causing PM underflow during remove operation. This is caused by the function, runtime_pm_get_sync, not being called anywhere during the op. Ensure that calls to pm_runtime_enable()/pm_runtime_disable() and pm_runtime_get_sync()/pm_runtime_put_sync() match.
echo 108d2000.spi > /sys/bus/platform/drivers/cadence-qspi/unbind
[ 49.644256] Deleting MTD partitions on "108d2000.spi.0": [ 49.649575] Deleting u-boot MTD partition [ 49.684087] Deleting root MTD partition [ 49.724188] cadence-qspi 108d2000.spi: Runtime PM usage count underflow!
Continuous bind/unbind will result in an "Unbalanced pm_runtime_enable" error. Subsequent unbind attempts will return a "No such device" error, while bind attempts will return a "Resource temporarily unavailable" error.
[ 47.592434] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 49.592233] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) [ 53.232309] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 55.828550] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) [ 57.940627] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 59.912490] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) [ 61.876243] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 61.883000] platform 108d2000.spi: Unbalanced pm_runtime_enable! [ 532.012270] cadence-qspi 108d2000.spi: probe with driver cadence-qspi failed1
Also, change clk_disable_unprepare() to clk_disable() since continuous bind and unbind operations will trigger a warning indicating that the clock is already unprepared.
drivers/spi/spi-cadence-quadspi.c +7 -5
@@ -1958,10 +1958,10 @@ static int cqspi_probe(struct platform_device *pdev) goto probe_setup_failed; } - ret =devm_pm_runtime_enable (dev); -if (ret) { -if (cqspi->rx_chan) -dma_release_channel (cqspi->rx_chan); +pm_runtime_enable (dev); + +if (cqspi->rx_chan) { +dma_release_channel (cqspi->rx_chan); goto probe_setup_failed; }
@@ -1981,6 +1981,7 @@ static int cqspi_probe(struct platform_device *pdev)return 0 ; probe_setup_failed:cqspi_controller_enable (cqspi,0 ); +pm_runtime_disable (dev); probe_reset_failed:if (cqspi->is_jh7110)cqspi_jh7110_disable_clk (pdev, cqspi);
@@ -1999,7 +2000,8 @@ static void cqspi_remove(struct platform_device *pdev)if (cqspi->rx_chan)dma_release_channel (cqspi->rx_chan); -clk_disable_unprepare (cqspi->clk); +if (pm_runtime_get_sync (&pdev->dev) >=0 ) +clk_disable (cqspi->clk);if (cqspi->is_jh7110)cqspi_jh7110_disable_clk (pdev, cqspi);
PATCH 1/1 spi: spi-cadence-quadspi: Fix pm runtime unbalance
From: Khairul Anuar Romli <[email protected]>
Having PM put sync in remove function is causing PM underflow during remove operation. This is caused by the function, runtime_pm_get_sync, not being called anywhere during the op. Ensure that calls to pm_runtime_enable()/pm_runtime_disable() and pm_runtime_get_sync()/pm_runtime_put_sync() match.
echo 108d2000.spi > /sys/bus/platform/drivers/cadence-qspi/unbind
[ 49.644256] Deleting MTD partitions on "108d2000.spi.0": [ 49.649575] Deleting u-boot MTD partition [ 49.684087] Deleting root MTD partition [ 49.724188] cadence-qspi 108d2000.spi: Runtime PM usage count underflow!
Continuous bind/unbind will result in an "Unbalanced pm_runtime_enable" error. Subsequent unbind attempts will return a "No such device" error, while bind attempts will return a "Resource temporarily unavailable" error.
[ 47.592434] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 49.592233] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) [ 53.232309] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 55.828550] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) [ 57.940627] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 59.912490] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) [ 61.876243] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 61.883000] platform 108d2000.spi: Unbalanced pm_runtime_enable! [ 532.012270] cadence-qspi 108d2000.spi: probe with driver cadence-qspi failed1
Also, change clk_disable_unprepare() to clk_disable() since continuous bind and unbind operations will trigger a warning indicating that the clock is already unprepared.
--- drivers/spi/spi-cadence-quadspi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/spi/spi-cadence-quadspi.c +10 -1
@@ -1868,6 +1868,13 @@ static int cqspi_probe(struct platform_device *pdev) goto probe_setup_failed; } +pm_runtime_enable (dev); + +if (cqspi->rx_chan) { +dma_release_channel (cqspi->rx_chan); + goto probe_setup_failed; + } + ret =spi_register_controller (host);if (ret) {dev_err (&pdev->dev,"failed to register SPI ctlr %d\n" , ret);
@@ -1877,6 +1884,7 @@ static int cqspi_probe(struct platform_device *pdev)return 0 ; probe_setup_failed:cqspi_controller_enable (cqspi,0 ); +pm_runtime_disable (dev); probe_reset_failed:if (cqspi->is_jh7110)cqspi_jh7110_disable_clk (pdev, cqspi);
@@ -1898,7 +1906,8 @@ static void cqspi_remove(struct platform_device *pdev)if (cqspi->rx_chan)dma_release_channel (cqspi->rx_chan); -clk_disable_unprepare (cqspi->clk); +if (pm_runtime_get_sync (&pdev->dev) >=0 ) +clk_disable (cqspi->clk);if (cqspi->is_jh7110)cqspi_jh7110_disable_clk (pdev, cqspi);
Signature · 1 line
2.35.3
Sasha Levin
maintainerRe: [PATCH 6.6.y] spi: spi-cadence-quadspi: Fix pm runtime unbalance
[ Sasha's backport helper bot ]
Hi,
Summary of potential issues:
⚠️ Found matching upstream commit but patch is missing proper reference to it
Found matching upstream commit: b07f349d1864abe29436f45e3047da2bdd476462
WARNING: Author mismatch between patch and found commit:
Backport author: [email protected]
Commit author: Khairul Anuar Romli<[email protected]>
Status in newer kernel trees:
6.15.y | Not found
6.12.y | Not found
Note: The patch differs from the upstream commit:
---
1: b07f349d1864a ! 1: 42de7106f3616 spi: spi-cadence-quadspi: Fix pm runtime unbalance
@@ Commit message
Reviewed-by: Matthew Gerlach <[email protected]>
Link: https://patch.msgid.link/4e7a4b8aba300e629b45a04f90bddf665fbdb335.1749601877.git.khairul.anuar.romli@altera.com
Signed-off-by: Mark Brown <[email protected]>
+ (cherry picked from commit b07f349d1864abe29436f45e3047da2bdd476462)
## drivers/spi/spi-cadence-quadspi.c ##
@@ drivers/spi/spi-cadence-quadspi.c: static int cqspi_probe(struct platform_device *pdev)
goto probe_setup_failed;
}
-- ret = devm_pm_runtime_enable(dev);
-- if (ret) {
-- if (cqspi->rx_chan)
-- dma_release_channel(cqspi->rx_chan);
+ pm_runtime_enable(dev);
+
+ if (cqspi->rx_chan) {
+ dma_release_channel(cqspi->rx_chan);
- goto probe_setup_failed;
- }
-
++ goto probe_setup_failed;
++ }
++
+ ret = spi_register_controller(host);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to register SPI ctlr %d\n", ret);
@@ drivers/spi/spi-cadence-quadspi.c: static int cqspi_probe(struct platform_device *pdev)
return 0;
probe_setup_failed:---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.6.y | Success | Success |