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] [day] [month] [year] [list]
Message-ID:
 <TY3PR01MB113468218C44791CAD67E7D9C86962@TY3PR01MB11346.jpnprd01.prod.outlook.com>
Date: Thu, 29 Aug 2024 06:58:32 +0000
From: Biju Das <biju.das.jz@...renesas.com>
To: Wang Jianzheng <wangjianzheng@...o.com>, Geert Uytterhoeven
	<geert+renesas@...der.be>, Linus Walleij <linus.walleij@...aro.org>, "open
 list:PIN CONTROLLER - RENESAS" <linux-renesas-soc@...r.kernel.org>, "open
 list:PIN CONTROL SUBSYSTEM" <linux-gpio@...r.kernel.org>, open list
	<linux-kernel@...r.kernel.org>
CC: "opensource.kernel@...o.com" <opensource.kernel@...o.com>
Subject: RE: [PATCH 5/5] pinctrl: renesas: Use devm_clk_get_enabled() helpers

Hi Wang,

Thanks for the patch.

> -----Original Message-----
> From: Wang Jianzheng <wangjianzheng@...o.com>
> Sent: Thursday, August 29, 2024 7:50 AM
> 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);

Now the clk can be local. Please drop clk from struct rzn1_pinctrl.

>  	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");

		Replace dev_err-->dev_err_probe.

		use struct device *dev = &pdev->dev and 
		replace all occurrences of &pdev->dev->dev as separate patch.

Cheers,
Biju

> -		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