* [PATCH] spi: cadence-qspi: Fix runtime PM imbalance in probe
@ 2025-11-30 9:12 Ali Tariq
2025-12-02 20:35 ` Mark Brown
2025-12-02 20:50 ` Andy Shevchenko
0 siblings, 2 replies; 4+ messages in thread
From: Ali Tariq @ 2025-11-30 9:12 UTC (permalink / raw)
To: broonie
Cc: linux-spi, linux-kernel, khairul.anuar.romli, adrianhoyin.ng,
nirav.rabara, matthew.gerlach, Ali Tariq
The probe function incorrectly calls pm_runtime_put_autosuspend()
twice in succession at the end of successful probe, dropping two
runtime PM references while only one was acquired earlier with
pm_runtime_get_sync(). This causes a usage count underflow:
cadence-qspi 13010000.spi: Runtime PM usage count underflow!
Remove the first redundant pm_runtime_put_autosuspend() call to
balance the reference count.
Tested on StarFive VisionFive 2 v1.2A board.
Fixes: 30dbc1c8d50f ("spi: cadence-qspi: defer runtime support on socfpga if reset bit is enabled")
Signed-off-by: Ali Tariq <alitariq45892@gmail.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 81017402bc56..638edca3805a 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.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] spi: cadence-qspi: Fix runtime PM imbalance in probe
2025-11-30 9:12 [PATCH] spi: cadence-qspi: Fix runtime PM imbalance in probe Ali Tariq
@ 2025-12-02 20:35 ` Mark Brown
2025-12-02 20:50 ` Andy Shevchenko
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2025-12-02 20:35 UTC (permalink / raw)
To: Ali Tariq
Cc: linux-spi, linux-kernel, khairul.anuar.romli, adrianhoyin.ng,
nirav.rabara, matthew.gerlach
On Sun, 30 Nov 2025 09:12:51 +0000, Ali Tariq wrote:
> The probe function incorrectly calls pm_runtime_put_autosuspend()
> twice in succession at the end of successful probe, dropping two
> runtime PM references while only one was acquired earlier with
> pm_runtime_get_sync(). This causes a usage count underflow:
>
> cadence-qspi 13010000.spi: Runtime PM usage count underflow!
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: cadence-qspi: Fix runtime PM imbalance in probe
commit: e1f2e77624dbc35f317efd7e092aa91f7136f3f9
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* Re: [PATCH] spi: cadence-qspi: Fix runtime PM imbalance in probe
2025-11-30 9:12 [PATCH] spi: cadence-qspi: Fix runtime PM imbalance in probe Ali Tariq
2025-12-02 20:35 ` Mark Brown
@ 2025-12-02 20:50 ` Andy Shevchenko
2025-12-04 11:21 ` Ali Tariq
1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2025-12-02 20:50 UTC (permalink / raw)
To: Ali Tariq
Cc: broonie, linux-spi, linux-kernel, khairul.anuar.romli,
adrianhoyin.ng, nirav.rabara, matthew.gerlach
On Sun, Nov 30, 2025 at 09:12:51AM +0000, Ali Tariq wrote:
> The probe function incorrectly calls pm_runtime_put_autosuspend()
> twice in succession at the end of successful probe, dropping two
> runtime PM references while only one was acquired earlier with
> pm_runtime_get_sync(). This causes a usage count underflow:
>
> cadence-qspi 13010000.spi: Runtime PM usage count underflow!
>
> Remove the first redundant pm_runtime_put_autosuspend() call to
> balance the reference count.
>
> Tested on StarFive VisionFive 2 v1.2A board.
...
> if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) {
> - pm_runtime_put_autosuspend(dev);
> pm_runtime_mark_last_busy(dev);
This one — pm_runtime_mark_last_busy() — also may be removed as it's integrated
into the _put_auutosuspend().
> pm_runtime_put_autosuspend(dev);
> }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] spi: cadence-qspi: Fix runtime PM imbalance in probe
2025-12-02 20:50 ` Andy Shevchenko
@ 2025-12-04 11:21 ` Ali Tariq
0 siblings, 0 replies; 4+ messages in thread
From: Ali Tariq @ 2025-12-04 11:21 UTC (permalink / raw)
To: Andy Shevchenko
Cc: broonie, linux-spi, linux-kernel, khairul.anuar.romli,
adrianhoyin.ng, nirav.rabara, matthew.gerlach
Thanks for the merge. Recently, there was a patch which removed the
redundant pm_runtime_mark_last_busy() call:
https://lore.kernel.org/linux-kernel/20251203181921.97171-1-akifejaz40@gmail.com/
The patch removes pm_runtime_mark_last_busy() from the probe function,
as pm_runtime_put_autosuspend() already handles this internally.
Best Regards,
Ali
On 12/3/25 1:50 AM, Andy Shevchenko wrote:
> On Sun, Nov 30, 2025 at 09:12:51AM +0000, Ali Tariq wrote:
>> The probe function incorrectly calls pm_runtime_put_autosuspend()
>> twice in succession at the end of successful probe, dropping two
>> runtime PM references while only one was acquired earlier with
>> pm_runtime_get_sync(). This causes a usage count underflow:
>>
>> cadence-qspi 13010000.spi: Runtime PM usage count underflow!
>>
>> Remove the first redundant pm_runtime_put_autosuspend() call to
>> balance the reference count.
>>
>> Tested on StarFive VisionFive 2 v1.2A board.
>
> ...
>
>> if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) {
>> - pm_runtime_put_autosuspend(dev);
>> pm_runtime_mark_last_busy(dev);
>
> This one — pm_runtime_mark_last_busy() — also may be removed as it's integrated
> into the _put_auutosuspend().
>
>> pm_runtime_put_autosuspend(dev);
>> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-04 11:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-30 9:12 [PATCH] spi: cadence-qspi: Fix runtime PM imbalance in probe Ali Tariq
2025-12-02 20:35 ` Mark Brown
2025-12-02 20:50 ` Andy Shevchenko
2025-12-04 11:21 ` Ali Tariq
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox