Skip to content

Commit 8509419

Browse files
smaeulstorulf
authored andcommitted
mmc: sunxi-mmc: Fix clock refcount imbalance during unbind
If the controller is suspended by runtime PM, the clock is already disabled, so do not try to disable it again during removal. Use pm_runtime_disable() to flush any pending runtime PM transitions. Fixes: 9a8e1e8 ("mmc: sunxi: Add runtime_pm support") Signed-off-by: Samuel Holland <[email protected]> Acked-by: Jernej Skrabec <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 1e336aa commit 8509419

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/mmc/host/sunxi-mmc.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,9 +1492,11 @@ static int sunxi_mmc_remove(struct platform_device *pdev)
14921492
struct sunxi_mmc_host *host = mmc_priv(mmc);
14931493

14941494
mmc_remove_host(mmc);
1495-
pm_runtime_force_suspend(&pdev->dev);
1496-
disable_irq(host->irq);
1497-
sunxi_mmc_disable(host);
1495+
pm_runtime_disable(&pdev->dev);
1496+
if (!pm_runtime_status_suspended(&pdev->dev)) {
1497+
disable_irq(host->irq);
1498+
sunxi_mmc_disable(host);
1499+
}
14981500
dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
14991501
mmc_free_host(mmc);
15001502

0 commit comments

Comments
 (0)