* [PATCH v2 1/1] spi: spi-cadence-quadspi: Fix pm runtime unbalance [not found] <cover.1749516352.git.khairul.anuar.romli@altera.com> @ 2025-06-10 22:30 ` khairul.anuar.romli 2025-06-10 23:22 ` Matthew Gerlach 0 siblings, 1 reply; 2+ messages in thread From: khairul.anuar.romli @ 2025-06-10 22:30 UTC (permalink / raw) To: Mark Brown, open list:SPI SUBSYSTEM, open list, Matthew Gerlach, Khairul Anuar Romli From: Khairul Anuar Romli <khairul.anuar.romli@altera.com> 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 throw Unbalanced pm_runtime_enable error. Subsequent unbind will return No such device error while bind attempt will return 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 the clk_disable_unprepare() to clk_disable() as continuous bind and unbind will cause warning being thrown with inidication that the clock is already unprepared. Fixes: 4892b374c9b7 ("mtd: spi-nor: cadence-quadspi: Add runtime PM support") cc: stable@vger.kernel.org # 6.6+ Signed-off-by: Khairul Anuar Romli <khairul.anuar.romli@altera.com> Reviewed-by: Matthew Gerlach <matthew.gerlach@altera.com> --- drivers/spi/spi-cadence-quadspi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index c90462783b3f..506a139fbd2c 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -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); -- 2.35.3 ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/1] spi: spi-cadence-quadspi: Fix pm runtime unbalance 2025-06-10 22:30 ` [PATCH v2 1/1] spi: spi-cadence-quadspi: Fix pm runtime unbalance khairul.anuar.romli @ 2025-06-10 23:22 ` Matthew Gerlach 0 siblings, 0 replies; 2+ messages in thread From: Matthew Gerlach @ 2025-06-10 23:22 UTC (permalink / raw) To: khairul.anuar.romli, Mark Brown, open list:SPI SUBSYSTEM, open list, Khairul Anuar Romli On 6/10/25 3:30 PM, khairul.anuar.romli@altera.com wrote: > From: Khairul Anuar Romli <khairul.anuar.romli@altera.com> > > 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 throw Unbalanced pm_runtime_enable error. > Subsequent unbind will return No such device error while bind attempt > will return 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 the clk_disable_unprepare() to clk_disable() as continuous > bind and unbind will cause warning being thrown with inidication that > the clock is already unprepared. > > Fixes: 4892b374c9b7 ("mtd: spi-nor: cadence-quadspi: Add runtime PM support") > cc: stable@vger.kernel.org # 6.6+ > Signed-off-by: Khairul Anuar Romli <khairul.anuar.romli@altera.com> > Reviewed-by: Matthew Gerlach <matthew.gerlach@altera.com> > --- Hi Khairul, It helps the reviewers, if a revision list highlighting the changes between is provided under the ---. Something like the following: v2: - Description of first change since v1. - Description of second change since v1. Matthew Gerlach > drivers/spi/spi-cadence-quadspi.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c > index c90462783b3f..506a139fbd2c 100644 > --- a/drivers/spi/spi-cadence-quadspi.c > +++ b/drivers/spi/spi-cadence-quadspi.c > @@ -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); ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-10 23:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <cover.1749516352.git.khairul.anuar.romli@altera.com>
2025-06-10 22:30 ` [PATCH v2 1/1] spi: spi-cadence-quadspi: Fix pm runtime unbalance khairul.anuar.romli
2025-06-10 23:22 ` Matthew Gerlach
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®