[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240827074857.2671808-8-xirui.zhang@vivo.com>
Date: Tue, 27 Aug 2024 01:48:45 -0600
From: zhangxirui <xirui.zhang@...o.com>
To: Robert Richter <rric@...nel.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
Jaehoon Chung <jh80.chung@...sung.com>,
Nicolas Pitre <nico@...xnic.net>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Taichi Sugaya <sugaya.taichi@...ionext.com>,
Takao Orito <orito.takao@...ionext.com>,
Michal Simek <michal.simek@....com>,
zhangxirui <xirui.zhang@...o.com>,
Linus Walleij <linus.walleij@...aro.org>,
Bastien Curutchet <bastien.curutchet@...tlin.com>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
linux-mmc@...r.kernel.org,
linux-kernel@...r.kernel.org,
imx@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org
Subject: [PATCH 7/9] mmc: sdhci: milbeaut: Use devm_clk_get_enabled() helpers
Use devm_clk_get_enabled() to simplify code
and avoids the calls to clk_disable_unprepare().
Signed-off-by: zhangxirui <xirui.zhang@...o.com>
---
drivers/mmc/host/sdhci-milbeaut.c | 25 ++++---------------------
1 file changed, 4 insertions(+), 21 deletions(-)
diff --git a/drivers/mmc/host/sdhci-milbeaut.c b/drivers/mmc/host/sdhci-milbeaut.c
index 83706edc9796..455e1e695ad6 100644
--- a/drivers/mmc/host/sdhci-milbeaut.c
+++ b/drivers/mmc/host/sdhci-milbeaut.c
@@ -275,39 +275,26 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev)
if (dev_of_node(dev)) {
sdhci_get_of_property(pdev);
- priv->clk_iface = devm_clk_get(&pdev->dev, "iface");
+ priv->clk_iface = devm_clk_get_enabled(&pdev->dev, "iface");
if (IS_ERR(priv->clk_iface)) {
ret = PTR_ERR(priv->clk_iface);
goto err;
}
- ret = clk_prepare_enable(priv->clk_iface);
- if (ret)
- goto err;
-
- priv->clk = devm_clk_get(&pdev->dev, "core");
+ priv->clk = devm_clk_get_enabled(&pdev->dev, "core");
if (IS_ERR(priv->clk)) {
ret = PTR_ERR(priv->clk);
- goto err_clk;
+ goto err;
}
-
- ret = clk_prepare_enable(priv->clk);
- if (ret)
- goto err_clk;
}
sdhci_milbeaut_init(host);
ret = sdhci_add_host(host);
if (ret)
- goto err_add_host;
+ goto err;
return 0;
-
-err_add_host:
- clk_disable_unprepare(priv->clk);
-err_clk:
- clk_disable_unprepare(priv->clk_iface);
err:
sdhci_free_host(host);
return ret;
@@ -316,14 +303,10 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev)
static void sdhci_milbeaut_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
- struct f_sdhost_priv *priv = sdhci_priv(host);
sdhci_remove_host(host, readl(host->ioaddr + SDHCI_INT_STATUS) ==
0xffffffff);
- clk_disable_unprepare(priv->clk_iface);
- clk_disable_unprepare(priv->clk);
-
sdhci_free_host(host);
platform_set_drvdata(pdev, NULL);
}
--
2.25.1
Powered by blists - more mailing lists