Skip to contentSkip to conversation

spi: imx: fix runtime pm leak on probe deferral

PATCH In review Johan Hovold 3 participants 5 messages Apr 21 – Apr 22

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: imx: fix runtime pm leak on probe deferral

Make sure to balance the runtime PM usage count before returning on probe failure (e.g. probe deferral) so that the controller can be suspended when a driver is later bound.

Fixes 43b6bf406cd0 ("spi: imx: fix runtime pm support for !CONFIG_PM")
Cc Sascha Hauer <[email protected]>
---
 drivers/spi/spi-imx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/spi/spi-imx.c +1 -0
index 4747899e0646..e5c907c45b87 100644
@@ -2373,6 +2373,7 @@ static int spi_imx_probe(struct platform_device *pdev)
 out_runtime_pm_put:
 	pm_runtime_dont_use_autosuspend(spi_imx->dev);
 	pm_runtime_disable(spi_imx->dev);
+	pm_runtime_put_noidle(spi_imx->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 
 	clk_disable_unprepare(spi_imx->clk_ipg);
Signature · 1 line
2.52.0
maintainer
#1 lore raw
Quoted 17 lines · Johan Hovold

Make sure to balance the runtime PM usage count before returning on probe failure (e.g. probe deferral) so that the controller can be suspended when a driver is later bound.

Fixes 43b6bf406cd0 ("spi: imx: fix runtime pm support for !CONFIG_PM")
Cc Sascha Hauer <[email protected]>
---
 drivers/spi/spi-imx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/spi/spi-imx.c +0 -0
index 4747899e0646..e5c907c45b87 100644

drivers/spi/spi-imx.c static int spi_imx_probe(struct platform_device *pdev) · line 2376

Quoted 4 lines
drivers/spi/spi-imx.c +1 -0
@@ -2373,6 +2373,7 @@ static int spi_imx_probe(struct platform_device *pdev)
 out_runtime_pm_put:
 	pm_runtime_dont_use_autosuspend(spi_imx->dev);
 	pm_runtime_disable(spi_imx->dev);
+	pm_runtime_put_noidle(spi_imx->dev);

use devm_pm_runtime_get_noresume() and devm_pm_runtime_enable() to fix this problem

Frank

Quoted 6 lines
drivers/spi/spi-imx.c +0 -1
 	pm_runtime_set_suspended(&pdev->dev);
 
 	clk_disable_unprepare(spi_imx->clk_ipg);
--

2.52.0

#2 lore raw
Quoted 13 lines · Frank Li
Quoted 12 lines · Johan Hovold

Make sure to balance the runtime PM usage count before returning on probe failure (e.g. probe deferral) so that the controller can be suspended when a driver is later bound.

Fixes 43b6bf406cd0 ("spi: imx: fix runtime pm support for !CONFIG_PM")
Cc Sascha Hauer <[email protected]>
---
 drivers/spi/spi-imx.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 12 lines

drivers/spi/spi-imx.c static int spi_imx_probe(struct platform_device *pdev) · line 2376

Quoted 9 lines
drivers/spi/spi-imx.c +1 -0
index 4747899e0646..e5c907c45b87 100644
@@ -2373,6 +2373,7 @@ static int spi_imx_probe(struct platform_device *pdev)
 out_runtime_pm_put:
 	pm_runtime_dont_use_autosuspend(spi_imx->dev);
 	pm_runtime_disable(spi_imx->dev);
+	pm_runtime_put_noidle(spi_imx->dev);

use devm_pm_runtime_get_noresume() and devm_pm_runtime_enable() to fix this problem

No. The first helper you mentioned was only added a year ago and does not even solve the issue without rewriting larger parts of the driver.

So that would need to be a separate change in any case.

Johan

maintainer
#3 lore raw
Quoted 27 lines · Johan Hovold
Quoted 13 lines · Frank Li
Quoted 12 lines · Johan Hovold

Make sure to balance the runtime PM usage count before returning on probe failure (e.g. probe deferral) so that the controller can be suspended when a driver is later bound.

Fixes 43b6bf406cd0 ("spi: imx: fix runtime pm support for !CONFIG_PM")
Cc Sascha Hauer <[email protected]>
---
 drivers/spi/spi-imx.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 12 lines

drivers/spi/spi-imx.c static int spi_imx_probe(struct platform_device *pdev) · line 2376

Quoted 9 lines
drivers/spi/spi-imx.c +1 -0
index 4747899e0646..e5c907c45b87 100644
@@ -2373,6 +2373,7 @@ static int spi_imx_probe(struct platform_device *pdev)
 out_runtime_pm_put:
 	pm_runtime_dont_use_autosuspend(spi_imx->dev);
 	pm_runtime_disable(spi_imx->dev);
+	pm_runtime_put_noidle(spi_imx->dev);

use devm_pm_runtime_get_noresume() and devm_pm_runtime_enable() to fix this problem

Quoted 4 lines

No. The first helper you mentioned was only added a year ago and does not even solve the issue without rewriting larger parts of the driver.

So that would need to be a separate change in any case.

It should be less 10 line code changes. separate change is okay, but suggest create following patches for this also.

Frank

Quoted 2 lines

Johan

maintainer
#4 lore raw
In reply to Johan Hovold
Quoted 1 line · Johan Hovold

spi: imx: fix runtime pm leak on probe deferral

Applied to

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

Thanks!

[1/1] spi: imx: fix runtime pm leak on probe deferral

      https://git.kernel.org/broonie/spi/c/a1d50a37d3b1

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