Skip to content

Commit

Permalink
spi: rockchip: Fix clock handling in remove
Browse files Browse the repository at this point in the history
We are assuming clocks enabled when calling rockchip_spi_remove, which
is not always true. Those clocks might already been disabled by the
runtime PM at that time.

Call pm_runtime_get_sync before trying to disable clocks to avoid that.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Jeffy Chen authored and Mark Brown committed Aug 7, 2017
1 parent 43de979 commit 6a06e89
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/spi/spi-rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,11 +816,15 @@ static int rockchip_spi_remove(struct platform_device *pdev)
struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
struct rockchip_spi *rs = spi_master_get_devdata(master);

pm_runtime_disable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);

clk_disable_unprepare(rs->spiclk);
clk_disable_unprepare(rs->apb_pclk);

pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);

if (rs->dma_tx.ch)
dma_release_channel(rs->dma_tx.ch);
if (rs->dma_rx.ch)
Expand Down

0 comments on commit 6a06e89

Please sign in to comment.