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-next>] [day] [month] [year] [list]
Message-Id: <20240829065018.36863-1-wangjianzheng@vivo.com>
Date: Thu, 29 Aug 2024 14:50:17 +0800
From: Wang Jianzheng <wangjianzheng@...o.com>
To: Geert Uytterhoeven <geert+renesas@...der.be>,
	Linus Walleij <linus.walleij@...aro.org>,
	linux-renesas-soc@...r.kernel.org (open list:PIN CONTROLLER - RENESAS),
	linux-gpio@...r.kernel.org (open list:PIN CONTROL SUBSYSTEM),
	linux-kernel@...r.kernel.org (open list)
Cc: opensource.kernel@...o.com,
	wangjianzheng@...o.com
Subject: [PATCH 5/5] pinctrl: renesas: Use devm_clk_get_enabled() helpers

The devm_clk_get_enabled() helpers:
    - call devm_clk_get()
    - call clk_prepare_enable() and register what is needed in order to
     call clk_disable_unprepare() when needed, as a managed resource.

This simplifies the code and avoids the calls to clk_disable_unprepare().

Signed-off-by: Wang Jianzheng <wangjianzheng@...o.com>
---
 drivers/pinctrl/renesas/pinctrl-rzn1.c | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c b/drivers/pinctrl/renesas/pinctrl-rzn1.c
index 39af1fe79c84..6a3616944b37 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzn1.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c
@@ -869,12 +869,9 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev)
 		return PTR_ERR(ipctl->lev2);
 	ipctl->lev2_protect_phys = (u32)res->start + 0x400;
 
-	ipctl->clk = devm_clk_get(&pdev->dev, NULL);
+	ipctl->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(ipctl->clk))
 		return PTR_ERR(ipctl->clk);
-	ret = clk_prepare_enable(ipctl->clk);
-	if (ret)
-		return ret;
 
 	ipctl->dev = &pdev->dev;
 	rzn1_pinctrl_desc.name = dev_name(&pdev->dev);
@@ -884,7 +881,7 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev)
 	ret = rzn1_pinctrl_probe_dt(pdev, ipctl);
 	if (ret) {
 		dev_err(&pdev->dev, "fail to probe dt properties\n");
-		goto err_clk;
+		return ret;
 	}
 
 	platform_set_drvdata(pdev, ipctl);
@@ -893,28 +890,16 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev)
 					     ipctl, &ipctl->pctl);
 	if (ret) {
 		dev_err(&pdev->dev, "could not register rzn1 pinctrl driver\n");
-		goto err_clk;
+		return ret;
 	}
 
 	ret = pinctrl_enable(ipctl->pctl);
 	if (ret)
-		goto err_clk;
+		return ret;
 
 	dev_info(&pdev->dev, "probed\n");
 
 	return 0;
-
-err_clk:
-	clk_disable_unprepare(ipctl->clk);
-
-	return ret;
-}
-
-static void rzn1_pinctrl_remove(struct platform_device *pdev)
-{
-	struct rzn1_pinctrl *ipctl = platform_get_drvdata(pdev);
-
-	clk_disable_unprepare(ipctl->clk);
 }
 
 static const struct of_device_id rzn1_pinctrl_match[] = {
@@ -925,7 +910,6 @@ MODULE_DEVICE_TABLE(of, rzn1_pinctrl_match);
 
 static struct platform_driver rzn1_pinctrl_driver = {
 	.probe	= rzn1_pinctrl_probe,
-	.remove_new = rzn1_pinctrl_remove,
 	.driver	= {
 		.name		= "rzn1-pinctrl",
 		.of_match_table	= rzn1_pinctrl_match,
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ