* [PATCH 0/2] OSPI pm_runtime fixes
@ 2025-11-05 16:11 Anurag Dutta
2025-11-05 16:11 ` [PATCH 1/2] spi: spi-cadence-quadspi: Enable pm runtime earlier to avoid imbalance Anurag Dutta
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Anurag Dutta @ 2025-11-05 16:11 UTC (permalink / raw)
To: broonie, khairul.anuar.romli, vigneshr
Cc: u-kumar1, s-k6, linux-spi, gehariprasath, linux-kernel
Hi all
This short series introduces fixes for OSPI pm_runtime to balance the
runtime PM reference counting.
Logs :
https://gist.github.com/anuragdutta731/238dbc6d9ff7927c63cd4dcfc51dfa97
Anurag Dutta (2):
spi: spi-cadence-quadspi: Enable pm runtime earlier to avoid imbalance
spi: spi-cadence-quadspi: Remove duplicate
pm_runtime_put_autosuspend() call
drivers/spi/spi-cadence-quadspi.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] spi: spi-cadence-quadspi: Enable pm runtime earlier to avoid imbalance
2025-11-05 16:11 [PATCH 0/2] OSPI pm_runtime fixes Anurag Dutta
@ 2025-11-05 16:11 ` Anurag Dutta
2025-11-05 16:11 ` [PATCH 2/2] spi: spi-cadence-quadspi: Remove duplicate pm_runtime_put_autosuspend() call Anurag Dutta
2025-11-14 17:07 ` [PATCH 0/2] OSPI pm_runtime fixes Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Anurag Dutta @ 2025-11-05 16:11 UTC (permalink / raw)
To: broonie, khairul.anuar.romli, vigneshr
Cc: u-kumar1, s-k6, linux-spi, gehariprasath, linux-kernel
The "probe_setup_failed" label calls pm_runtime_disable(), but
pm_runtime_enable() was placed after a possible jump to this label.
When cqspi_setup_flash() fails, control jumps to the label without
pm_runtime_enable() being called, leading to unbalanced PM runtime
reference counting.
Move pm_runtime_enable() and associated calls above the first
possible branch to "probe_setup_failed" to ensure balanced
enable/disable calls across all error paths.
Fixes: 30dbc1c8d50f ("spi: cadence-qspi: defer runtime support on socfpga if reset bit is enabled")
Signed-off-by: Anurag Dutta <a-dutta@ti.com>
---
drivers/spi/spi-cadence-quadspi.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index 81017402bc56..56906dc76b34 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -1981,6 +1981,13 @@ static int cqspi_probe(struct platform_device *pdev)
cqspi->current_cs = -1;
cqspi->sclk = 0;
+ if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) {
+ pm_runtime_enable(dev);
+ pm_runtime_set_autosuspend_delay(dev, CQSPI_AUTOSUSPEND_TIMEOUT);
+ pm_runtime_use_autosuspend(dev);
+ pm_runtime_get_noresume(dev);
+ }
+
ret = cqspi_setup_flash(cqspi);
if (ret) {
dev_err(dev, "failed to setup flash parameters %d\n", ret);
@@ -1998,13 +2005,6 @@ static int cqspi_probe(struct platform_device *pdev)
goto probe_dma_failed;
}
- if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) {
- pm_runtime_enable(dev);
- pm_runtime_set_autosuspend_delay(dev, CQSPI_AUTOSUSPEND_TIMEOUT);
- pm_runtime_use_autosuspend(dev);
- pm_runtime_get_noresume(dev);
- }
-
ret = spi_register_controller(host);
if (ret) {
dev_err(&pdev->dev, "failed to register SPI ctlr %d\n", ret);
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] spi: spi-cadence-quadspi: Remove duplicate pm_runtime_put_autosuspend() call
2025-11-05 16:11 [PATCH 0/2] OSPI pm_runtime fixes Anurag Dutta
2025-11-05 16:11 ` [PATCH 1/2] spi: spi-cadence-quadspi: Enable pm runtime earlier to avoid imbalance Anurag Dutta
@ 2025-11-05 16:11 ` Anurag Dutta
2025-11-14 17:07 ` [PATCH 0/2] OSPI pm_runtime fixes Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Anurag Dutta @ 2025-11-05 16:11 UTC (permalink / raw)
To: broonie, khairul.anuar.romli, vigneshr
Cc: u-kumar1, s-k6, linux-spi, gehariprasath, linux-kernel
Fix runtime PM usage count underflow caused by calling
pm_runtime_put_autosuspend() twice with only one corresponding
pm_runtime_get_noresume() call. This triggers the warning:
"Runtime PM usage count underflow!"
Remove the duplicate put call to balance the runtime PM reference
counting.
Fixes: 30dbc1c8d50f ("spi: cadence-qspi: defer runtime support on socfpga if reset bit is enabled")
Signed-off-by: Anurag Dutta <a-dutta@ti.com>
---
drivers/spi/spi-cadence-quadspi.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index 56906dc76b34..8e0df08609c0 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -2012,7 +2012,6 @@ static int cqspi_probe(struct platform_device *pdev)
}
if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) {
- pm_runtime_put_autosuspend(dev);
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
}
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] OSPI pm_runtime fixes
2025-11-05 16:11 [PATCH 0/2] OSPI pm_runtime fixes Anurag Dutta
2025-11-05 16:11 ` [PATCH 1/2] spi: spi-cadence-quadspi: Enable pm runtime earlier to avoid imbalance Anurag Dutta
2025-11-05 16:11 ` [PATCH 2/2] spi: spi-cadence-quadspi: Remove duplicate pm_runtime_put_autosuspend() call Anurag Dutta
@ 2025-11-14 17:07 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2025-11-14 17:07 UTC (permalink / raw)
To: khairul.anuar.romli, vigneshr, Anurag Dutta
Cc: u-kumar1, s-k6, linux-spi, gehariprasath, linux-kernel
On Wed, 05 Nov 2025 21:41:44 +0530, Anurag Dutta wrote:
> This short series introduces fixes for OSPI pm_runtime to balance the
> runtime PM reference counting.
>
> Logs :
> https://gist.github.com/anuragdutta731/238dbc6d9ff7927c63cd4dcfc51dfa97
>
> Anurag Dutta (2):
> spi: spi-cadence-quadspi: Enable pm runtime earlier to avoid imbalance
> spi: spi-cadence-quadspi: Remove duplicate
> pm_runtime_put_autosuspend() call
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/2] spi: spi-cadence-quadspi: Enable pm runtime earlier to avoid imbalance
commit: f1eb4e792bb1ee3dcdffa66f8a83a4867cda2dd3
[2/2] spi: spi-cadence-quadspi: Remove duplicate pm_runtime_put_autosuspend() call
commit: 10eaa4c4a257944e9b30d13fda7d09164a70866d
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.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-14 17:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-05 16:11 [PATCH 0/2] OSPI pm_runtime fixes Anurag Dutta
2025-11-05 16:11 ` [PATCH 1/2] spi: spi-cadence-quadspi: Enable pm runtime earlier to avoid imbalance Anurag Dutta
2025-11-05 16:11 ` [PATCH 2/2] spi: spi-cadence-quadspi: Remove duplicate pm_runtime_put_autosuspend() call Anurag Dutta
2025-11-14 17:07 ` [PATCH 0/2] OSPI pm_runtime fixes Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®