Commit be6ef160 authored by Patrice Chotard's avatar Patrice Chotard Committed by Mark Brown

spi: stm32-qspi: Fix unbalanced pm_runtime_enable issue

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: 9d282c17 ("spi: stm32-qspi: Add pm_runtime support")
Signed-off-by: default avatarPatrice Chotard <patrice.chotard@st.com>
Link: https://lore.kernel.org/r/20200429102625.25974-1-patrice.chotard@st.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 18168291
...@@ -555,10 +555,15 @@ static const struct spi_controller_mem_ops stm32_qspi_mem_ops = { ...@@ -555,10 +555,15 @@ static const struct spi_controller_mem_ops stm32_qspi_mem_ops = {
static void stm32_qspi_release(struct stm32_qspi *qspi) static void stm32_qspi_release(struct stm32_qspi *qspi)
{ {
pm_runtime_get_sync(qspi->dev);
/* disable qspi */ /* disable qspi */
writel_relaxed(0, qspi->io_base + QSPI_CR); writel_relaxed(0, qspi->io_base + QSPI_CR);
stm32_qspi_dma_free(qspi); stm32_qspi_dma_free(qspi);
mutex_destroy(&qspi->lock); 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); clk_disable_unprepare(qspi->clk);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment