Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b414368 authored by Ulf Hansson's avatar Ulf Hansson
Browse files

mmc: sdhci-esdhc-imx: Fixup ->remove()



Since sdhci_remove_host() access the device, we need to make sure it's
runtime PM resumed.

To handle clock gating properly in remove, we first have to make sure
the clocks are ungated.

To fix both these issues, by invoking pm_runtime_get_sync() early in
->remove() callback. Later once we disabled runtime PM, we can restore
the usage count.

Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 0ac223a4
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -1103,16 +1103,15 @@ static int sdhci_esdhc_imx_remove(struct platform_device *pdev)
	struct pltfm_imx_data *imx_data = pltfm_host->priv;
	int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);

	sdhci_remove_host(host, dead);

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

	sdhci_remove_host(host, dead);

	if (!IS_ENABLED(CONFIG_PM)) {
	clk_disable_unprepare(imx_data->clk_per);
	clk_disable_unprepare(imx_data->clk_ipg);
	clk_disable_unprepare(imx_data->clk_ahb);
	}

	sdhci_pltfm_free(pdev);