Skip to content

Commit 8509419

Browse files
smaeulUlf Hansson
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 <samuel@sholland.org> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220810022509.43743-1-samuel@sholland.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 1e336aa commit 8509419

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

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)