linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* spi: stm32-qspi: Fix unbalanced pm_runtime_enable issue
@ 2020-04-29 10:26 patrice.chotard
  2020-04-29 17:52 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: patrice.chotard @ 2020-04-29 10:26 UTC (permalink / raw)
  To: Mark Brown, Alexandre Torgue
  Cc: linux-kernel, Patrice Chotard, mcoquelin.stm32, linux-spi,
	linux-stm32, linux-arm-kernel

From: Patrice Chotard <patrice.chotard@st.com>

Issue detected by unbinding/binding the stm32 qspi driver as following:

root@stm32mp2:~# echo 40430000.spi > /sys/bus/platform/drivers/stm32-qspi/404300
00.spi/driver/unbind
root@stm32mp2:~# echo 40430000.spi > /sys/bus/platform/drivers/stm32-qspi/bind
[  969.864021] stm32-qspi 40430000.spi: Unbalanced pm_runtime_enable!
[  970.225161] spi-nor spi0.0: mx66u51235f (65536 Kbytes)
[  970.935721] spi-nor spi0.1: mx66u51235f (65536 Kbytes)

Fixes: 9d282c17b023 ("spi: stm32-qspi: Add pm_runtime support")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
 drivers/spi/spi-stm32-qspi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c
index 2f2ea2c42d6e..3c44bb2fd9b1 100644
--- a/drivers/spi/spi-stm32-qspi.c
+++ b/drivers/spi/spi-stm32-qspi.c
@@ -555,10 +555,15 @@ static const struct spi_controller_mem_ops stm32_qspi_mem_ops = {
 
 static void stm32_qspi_release(struct stm32_qspi *qspi)
 {
+	pm_runtime_get_sync(qspi->dev);
 	/* disable qspi */
 	writel_relaxed(0, qspi->io_base + QSPI_CR);
 	stm32_qspi_dma_free(qspi);
 	mutex_destroy(&qspi->lock);
+	pm_runtime_put_noidle(qspi->dev);
+	pm_runtime_disable(qspi->dev);
+	pm_runtime_set_suspended(qspi->dev);
+	pm_runtime_dont_use_autosuspend(qspi->dev);
 	clk_disable_unprepare(qspi->clk);
 }
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: spi: stm32-qspi: Fix unbalanced pm_runtime_enable issue
  2020-04-29 10:26 spi: stm32-qspi: Fix unbalanced pm_runtime_enable issue patrice.chotard
@ 2020-04-29 17:52 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2020-04-29 17:52 UTC (permalink / raw)
  To: patrice.chotard, Alexandre Torgue
  Cc: mcoquelin.stm32, linux-kernel, linux-stm32, linux-arm-kernel, linux-spi

On Wed, 29 Apr 2020 12:26:25 +0200, patrice.chotard@st.com wrote:
> From: Patrice Chotard <patrice.chotard@st.com>
> 
> Issue detected by unbinding/binding the stm32 qspi driver as following:
> 
> root@stm32mp2:~# echo 40430000.spi > /sys/bus/platform/drivers/stm32-qspi/404300
> 00.spi/driver/unbind
> root@stm32mp2:~# echo 40430000.spi > /sys/bus/platform/drivers/stm32-qspi/bind
> [  969.864021] stm32-qspi 40430000.spi: Unbalanced pm_runtime_enable!
> [  970.225161] spi-nor spi0.0: mx66u51235f (65536 Kbytes)
> [  970.935721] spi-nor spi0.1: mx66u51235f (65536 Kbytes)
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.8

Thanks!

[1/1] spi: stm32-qspi: Fix unbalanced pm_runtime_enable issue
      commit: be6ef160840f23d9723d9bd008ca08e864ce4745

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-29 17:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 10:26 spi: stm32-qspi: Fix unbalanced pm_runtime_enable issue patrice.chotard
2020-04-29 17:52 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).