Unverified Commit 8370f1bd authored by Mark Brown's avatar Mark Brown
Browse files

spi: orion: runtime PM fixes

Johan Hovold <johan@kernel.org> says:

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

Included is also a related clean up.
parents a1d50a37 fa5061da
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -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) {
@@ -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;

	return status;
	pm_runtime_put_autosuspend(&pdev->dev);

	return 0;

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:
@@ -811,6 +817,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);