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-6-xirui.zhang@vivo.com>
Date: Tue, 27 Aug 2024 01:48:43 -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>,
	Bartosz Golaszewski <bartosz.golaszewski@...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 5/9] mmc: mxcmmc: 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/mxcmmc.c | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 1edf65291354..171e1f6a5611 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -1069,26 +1069,18 @@ static int mxcmci_probe(struct platform_device *pdev)
 	else
 		host->default_irq_mask = 0;
 
-	host->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
+	host->clk_ipg = devm_clk_get_enabled(&pdev->dev, "ipg");
 	if (IS_ERR(host->clk_ipg)) {
 		ret = PTR_ERR(host->clk_ipg);
 		goto out_free;
 	}
 
-	host->clk_per = devm_clk_get(&pdev->dev, "per");
+	host->clk_per = devm_clk_get_enabled(&pdev->dev, "per");
 	if (IS_ERR(host->clk_per)) {
 		ret = PTR_ERR(host->clk_per);
 		goto out_free;
 	}
 
-	ret = clk_prepare_enable(host->clk_per);
-	if (ret)
-		goto out_free;
-
-	ret = clk_prepare_enable(host->clk_ipg);
-	if (ret)
-		goto out_clk_per_put;
-
 	mxcmci_softreset(host);
 
 	host->rev_no = mxcmci_readw(host, MMC_REG_REV_NO);
@@ -1096,7 +1088,7 @@ static int mxcmci_probe(struct platform_device *pdev)
 		ret = -ENODEV;
 		dev_err(mmc_dev(host->mmc), "wrong rev.no. 0x%08x. aborting.\n",
 			host->rev_no);
-		goto out_clk_put;
+		goto out_free;
 	}
 
 	mmc->f_min = clk_get_rate(host->clk_per) >> 16;
@@ -1112,7 +1104,7 @@ static int mxcmci_probe(struct platform_device *pdev)
 		if (IS_ERR(host->dma)) {
 			if (PTR_ERR(host->dma) == -EPROBE_DEFER) {
 				ret = -EPROBE_DEFER;
-				goto out_clk_put;
+				goto out_free;
 			}
 
 			/* Ignore errors to fall back to PIO mode */
@@ -1163,12 +1155,6 @@ static int mxcmci_probe(struct platform_device *pdev)
 out_free_dma:
 	if (host->dma)
 		dma_release_channel(host->dma);
-
-out_clk_put:
-	clk_disable_unprepare(host->clk_ipg);
-out_clk_per_put:
-	clk_disable_unprepare(host->clk_per);
-
 out_free:
 	mmc_free_host(mmc);
 
@@ -1188,9 +1174,6 @@ static void mxcmci_remove(struct platform_device *pdev)
 	if (host->dma)
 		dma_release_channel(host->dma);
 
-	clk_disable_unprepare(host->clk_per);
-	clk_disable_unprepare(host->clk_ipg);
-
 	mmc_free_host(mmc);
 }
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ