]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
spi: spi-imx: Fix pm_runtime_set_suspended() with runtime pm enabled
authorJinjie Ruan <ruanjinjie@huawei.com>
Mon, 23 Sep 2024 04:00:13 +0000 (12:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:08:17 +0000 (15:08 +0200)
[ Upstream commit b6e05ba0844139dde138625906015c974c86aa93 ]

It is not valid to call pm_runtime_set_suspended() for devices
with runtime PM enabled because it returns -EAGAIN if it is enabled
already and working. So, call pm_runtime_disable() before to fix it.

Fixes: 43b6bf406cd0 ("spi: imx: fix runtime pm support for !CONFIG_PM")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Link: https://patch.msgid.link/20240923040015.3009329-2-ruanjinjie@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-imx.c

index 8566da12d15e3b31815023a7583e9b7171b4c61f..f1a0073a8700fc9da2c7067151a593a55ec901df 100644 (file)
@@ -1756,8 +1756,8 @@ out_bitbang_start:
                spi_imx_sdma_exit(spi_imx);
 out_runtime_pm_put:
        pm_runtime_dont_use_autosuspend(spi_imx->dev);
-       pm_runtime_set_suspended(&pdev->dev);
        pm_runtime_disable(spi_imx->dev);
+       pm_runtime_set_suspended(&pdev->dev);
 
        clk_disable_unprepare(spi_imx->clk_ipg);
 out_put_per: