Skip to content

Commit 0374930

Browse files
lsun100storulf
authored andcommitted
sdhci-of-dwcmshc: disable PM runtime in dwcmshc_remove()
This commit disables PM runtime in dwcmshc_remove() to avoid the error message below when reloading the sdhci-of-dwcmshc.ko sdhci-dwcmshc MLNXBF30:00: Unbalanced pm_runtime_enable! Fixes: 48fe8fa ("mmc: sdhci-of-dwcmshc: Add runtime PM operations") Reviewed-by: David Thompson <davthompson@nvidia.com> Signed-off-by: Liming Sun <limings@nvidia.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/b9155963ffb12d18375002bf9ac9a3f98b727fc8.1710854108.git.limings@nvidia.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent f9e2a5b commit 0374930

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

drivers/mmc/host/sdhci-of-dwcmshc.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -999,15 +999,32 @@ static int dwcmshc_probe(struct platform_device *pdev)
999999
return err;
10001000
}
10011001

1002+
static void dwcmshc_disable_card_clk(struct sdhci_host *host)
1003+
{
1004+
u16 ctrl;
1005+
1006+
ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
1007+
if (ctrl & SDHCI_CLOCK_CARD_EN) {
1008+
ctrl &= ~SDHCI_CLOCK_CARD_EN;
1009+
sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL);
1010+
}
1011+
}
1012+
10021013
static void dwcmshc_remove(struct platform_device *pdev)
10031014
{
10041015
struct sdhci_host *host = platform_get_drvdata(pdev);
10051016
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
10061017
struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host);
10071018
struct rk35xx_priv *rk_priv = priv->priv;
10081019

1020+
pm_runtime_get_sync(&pdev->dev);
1021+
pm_runtime_disable(&pdev->dev);
1022+
pm_runtime_put_noidle(&pdev->dev);
1023+
10091024
sdhci_remove_host(host, 0);
10101025

1026+
dwcmshc_disable_card_clk(host);
1027+
10111028
clk_disable_unprepare(pltfm_host->clk);
10121029
clk_disable_unprepare(priv->bus_clk);
10131030
if (rk_priv)
@@ -1099,17 +1116,6 @@ static void dwcmshc_enable_card_clk(struct sdhci_host *host)
10991116
}
11001117
}
11011118

1102-
static void dwcmshc_disable_card_clk(struct sdhci_host *host)
1103-
{
1104-
u16 ctrl;
1105-
1106-
ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
1107-
if (ctrl & SDHCI_CLOCK_CARD_EN) {
1108-
ctrl &= ~SDHCI_CLOCK_CARD_EN;
1109-
sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL);
1110-
}
1111-
}
1112-
11131119
static int dwcmshc_runtime_suspend(struct device *dev)
11141120
{
11151121
struct sdhci_host *host = dev_get_drvdata(dev);

0 commit comments

Comments
 (0)