Skip to content

Commit 80e2100

Browse files
committed
sdhci-of-dwcmshc: disable PM runtime in dwcmshc_remove()
JIRA: https://issues.redhat.com/browse/RHEL-45234 commit 0374930 Author: Liming Sun <limings@nvidia.com> Date: Tue, 19 Mar 2024 12:16:16 -0400 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> Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
1 parent ac8c8f8 commit 80e2100

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
@@ -584,15 +584,32 @@ static int dwcmshc_probe(struct platform_device *pdev)
584584
return err;
585585
}
586586

587+
static void dwcmshc_disable_card_clk(struct sdhci_host *host)
588+
{
589+
u16 ctrl;
590+
591+
ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
592+
if (ctrl & SDHCI_CLOCK_CARD_EN) {
593+
ctrl &= ~SDHCI_CLOCK_CARD_EN;
594+
sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL);
595+
}
596+
}
597+
587598
static void dwcmshc_remove(struct platform_device *pdev)
588599
{
589600
struct sdhci_host *host = platform_get_drvdata(pdev);
590601
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
591602
struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host);
592603
struct rk35xx_priv *rk_priv = priv->priv;
593604

605+
pm_runtime_get_sync(&pdev->dev);
606+
pm_runtime_disable(&pdev->dev);
607+
pm_runtime_put_noidle(&pdev->dev);
608+
594609
sdhci_remove_host(host, 0);
595610

611+
dwcmshc_disable_card_clk(host);
612+
596613
clk_disable_unprepare(pltfm_host->clk);
597614
clk_disable_unprepare(priv->bus_clk);
598615
if (rk_priv)
@@ -684,17 +701,6 @@ static void dwcmshc_enable_card_clk(struct sdhci_host *host)
684701
}
685702
}
686703

687-
static void dwcmshc_disable_card_clk(struct sdhci_host *host)
688-
{
689-
u16 ctrl;
690-
691-
ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
692-
if (ctrl & SDHCI_CLOCK_CARD_EN) {
693-
ctrl &= ~SDHCI_CLOCK_CARD_EN;
694-
sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL);
695-
}
696-
}
697-
698704
static int dwcmshc_runtime_suspend(struct device *dev)
699705
{
700706
struct sdhci_host *host = dev_get_drvdata(dev);

0 commit comments

Comments
 (0)