Commit 85094197 authored by Samuel Holland's avatar Samuel Holland Committed by Ulf Hansson
Browse files

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: 9a8e1e8c ("mmc: sunxi: Add runtime_pm support")
Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
Acked-by: default avatarJernej 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: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 1e336aa0
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -1492,9 +1492,11 @@ static int sunxi_mmc_remove(struct platform_device *pdev)
	struct sunxi_mmc_host *host = mmc_priv(mmc);

	mmc_remove_host(mmc);
	pm_runtime_force_suspend(&pdev->dev);
	pm_runtime_disable(&pdev->dev);
	if (!pm_runtime_status_suspended(&pdev->dev)) {
		disable_irq(host->irq);
		sunxi_mmc_disable(host);
	}
	dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
	mmc_free_host(mmc);