Skip to contentSkip to conversation

spi: orion: runtime PM fixes

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

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

cover spi: orion: runtime PM fixes

This series fixes some runtime PM related issues in the orion driver.

Included is also a related clean up.

Johan

Johan Hovold (3):
spi: orion: fix runtime pm leak on unbind
spi: orion: fix clock imbalance on registration failure
spi: orion: clean up probe return value

 drivers/spi/spi-orion.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
Signature · 1 line
2.52.0
#1 lore raw

PATCH 1/3 spi: orion: fix runtime pm leak on unbind

Make sure to balance the runtime PM usage count on driver unbind so that the controller can be suspended when a driver is rebound.

Also restore the autosuspend setting.

This issue was flagged by Sashiko when reviewing a controller deregistration fix.

Fixes 5c6786945b4e ("spi: spi-orion: add runtime PM support")
Cc Russell King <[email protected]>
---
 drivers/spi/spi-orion.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/spi/spi-orion.c +3 -0
index c54cd4ef09bd..c61ebfd1d18d 100644
@@ -811,6 +811,9 @@ static void orion_spi_remove(struct platform_device *pdev)
 	spi_controller_put(host);
 
 	pm_runtime_disable(&pdev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
+	pm_runtime_set_suspended(&pdev->dev);
+	pm_runtime_dont_use_autosuspend(&pdev->dev);
 }
 
 MODULE_ALIAS("platform:" DRIVER_NAME);
Signature · 1 line
2.52.0
#2 lore raw

PATCH 2/3 spi: orion: fix clock imbalance on registration failure

In reply to Johan Hovold

Make sure that the controller is not runtime suspended before disabling clocks on probe failure.

Also restore the autosuspend setting.

Fixes 5c6786945b4e ("spi: spi-orion: add runtime PM support")
Cc Russell King <[email protected]>
---
 drivers/spi/spi-orion.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/spi/spi-orion.c +6 -0
index c61ebfd1d18d..a5ce970ff5a8 100644
@@ -774,6 +774,7 @@ static int orion_spi_probe(struct platform_device *pdev)
 	pm_runtime_set_active(&pdev->dev);
 	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
+	pm_runtime_get_noresume(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
 
 	status = orion_spi_reset(spi);
@@ -784,10 +785,15 @@ static int orion_spi_probe(struct platform_device *pdev)
 	if (status < 0)
 		goto out_rel_pm;
 
+	pm_runtime_put_autosuspend(&pdev->dev);
+
 	return status;
 
 out_rel_pm:
 	pm_runtime_disable(&pdev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
+	pm_runtime_set_suspended(&pdev->dev);
+	pm_runtime_dont_use_autosuspend(&pdev->dev);
 out_rel_axi_clk:
 	clk_disable_unprepare(spi->axi_clk);
 out:
Signature · 1 line
2.52.0
#3 lore raw

PATCH 3/3 spi: orion: clean up probe return value

In reply to Johan Hovold

Drop the redundant initialisation and return explicit zero on successful probe to make the code more readable.

---
 drivers/spi/spi-orion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-orion.c +2 -2
index a5ce970ff5a8..64bf215c1804 100644
@@ -648,8 +648,8 @@ static int orion_spi_probe(struct platform_device *pdev)
 	struct orion_spi *spi;
 	struct resource *r;
 	unsigned long tclk_hz;
-	int status = 0;
 	struct device_node *np;
+	int status;
 
 	host = spi_alloc_host(&pdev->dev, sizeof(*spi));
 	if (host == NULL) {
@@ -787,7 +787,7 @@ static int orion_spi_probe(struct platform_device *pdev)
 
 	pm_runtime_put_autosuspend(&pdev->dev);
 
-	return status;
+	return 0;
 
 out_rel_pm:
 	pm_runtime_disable(&pdev->dev);
Signature · 1 line
2.52.0
maintainer
#4 lore raw
In reply to Johan Hovold
Quoted 9 lines · Johan Hovold

spi: orion: runtime PM fixes

This series fixes some runtime PM related issues in the orion driver.

Included is also a related clean up.

Johan

[...]

Applied to

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

Thanks!

[1/3] spi: orion: fix runtime pm leak on unbind

      https://git.kernel.org/broonie/spi/c/97b17dd8266d
[2/3] spi: orion: fix clock imbalance on registration failure
      https://git.kernel.org/broonie/spi/c/443cde0dc59c
[3/3] spi: orion: clean up probe return value
      https://git.kernel.org/broonie/spi/c/fa5061daffe8

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