lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240827074857.2671808-4-xirui.zhang@vivo.com>
Date: Tue, 27 Aug 2024 01:48:41 -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>,
	Bastien Curutchet <bastien.curutchet@...tlin.com>,
	Linus Walleij <linus.walleij@...aro.org>,
	Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
	linux-mmc@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	imx@...ts.linux.dev,
	linux-arm-kernel@...ts.infradead.org
Subject: [PATCH 3/9] mmc: dw_mmc-hi3798cv200: 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/dw_mmc-hi3798cv200.c | 28 +++------------------------
 1 file changed, 3 insertions(+), 25 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-hi3798cv200.c b/drivers/mmc/host/dw_mmc-hi3798cv200.c
index 6099756e59b3..aef28cf807b0 100644
--- a/drivers/mmc/host/dw_mmc-hi3798cv200.c
+++ b/drivers/mmc/host/dw_mmc-hi3798cv200.c
@@ -120,42 +120,26 @@ static int dw_mci_hi3798cv200_execute_tuning(struct dw_mci_slot *slot,
 static int dw_mci_hi3798cv200_init(struct dw_mci *host)
 {
 	struct hi3798cv200_priv *priv;
-	int ret;
 
 	priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
-	priv->sample_clk = devm_clk_get(host->dev, "ciu-sample");
+	priv->sample_clk = devm_clk_get_enabled(host->dev, "ciu-sample");
 	if (IS_ERR(priv->sample_clk)) {
 		dev_err(host->dev, "failed to get ciu-sample clock\n");
 		return PTR_ERR(priv->sample_clk);
 	}
 
-	priv->drive_clk = devm_clk_get(host->dev, "ciu-drive");
+	priv->drive_clk = devm_clk_get_enabled(host->dev, "ciu-drive");
 	if (IS_ERR(priv->drive_clk)) {
 		dev_err(host->dev, "failed to get ciu-drive clock\n");
 		return PTR_ERR(priv->drive_clk);
 	}
 
-	ret = clk_prepare_enable(priv->sample_clk);
-	if (ret) {
-		dev_err(host->dev, "failed to enable ciu-sample clock\n");
-		return ret;
-	}
-
-	ret = clk_prepare_enable(priv->drive_clk);
-	if (ret) {
-		dev_err(host->dev, "failed to enable ciu-drive clock\n");
-		goto disable_sample_clk;
-	}
-
 	host->priv = priv;
-	return 0;
 
-disable_sample_clk:
-	clk_disable_unprepare(priv->sample_clk);
-	return ret;
+	return 0;
 }
 
 static const struct dw_mci_drv_data hi3798cv200_data = {
@@ -172,12 +156,6 @@ static int dw_mci_hi3798cv200_probe(struct platform_device *pdev)
 
 static void dw_mci_hi3798cv200_remove(struct platform_device *pdev)
 {
-	struct dw_mci *host = platform_get_drvdata(pdev);
-	struct hi3798cv200_priv *priv = host->priv;
-
-	clk_disable_unprepare(priv->drive_clk);
-	clk_disable_unprepare(priv->sample_clk);
-
 	dw_mci_pltfm_remove(pdev);
 }
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ