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: <3144eb08-ca46-42df-9a7d-c541ad534857@roeck-us.net>
Date:   Tue, 7 Mar 2023 09:55:18 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     Keguang Zhang <keguang.zhang@...il.com>,
        Wim Van Sebroeck <wim@...ux-watchdog.org>,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        linux-mips@...r.kernel.org, linux-watchdog@...r.kernel.org
Subject: Re: [PATCH] watchdog: loongson1: Use devm_clk_get_enabled() helper

On Sat, Dec 31, 2022 at 12:14:30PM +0100, Christophe JAILLET wrote:
> The devm_clk_get_enabled() helper:
>    - calls devm_clk_get()
>    - calls clk_prepare_enable() and registers what is needed in order to
>      call clk_disable_unprepare() when needed, as a managed resource.
> 
> This simplifies the code and avoids the need of a dedicated function used
> with devm_add_action_or_reset().
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>

Reviewed-by: Guenter Roeck <linux@...ck-us.net>

> ---
> Note that I get a compilation error because <loongson1.h> is not found on
> my system (x86_64).
> So I think that a "depends on LOONG<something>" in missing in a KConfig
> file.

It has "depends on MACH_LOONGSON32" and is not expected to be buildable if
MACH_LOONGSON32 is not selected. It builds just fine if MACH_LOONGSON32
is selected.

Guenter

> 
> Fixing it could help compilation farms build-bots.
> ---
>  drivers/watchdog/loongson1_wdt.c | 17 +----------------
>  1 file changed, 1 insertion(+), 16 deletions(-)
> 
> diff --git a/drivers/watchdog/loongson1_wdt.c b/drivers/watchdog/loongson1_wdt.c
> index bb3d075c0633..c55656cfb403 100644
> --- a/drivers/watchdog/loongson1_wdt.c
> +++ b/drivers/watchdog/loongson1_wdt.c
> @@ -79,11 +79,6 @@ static const struct watchdog_ops ls1x_wdt_ops = {
>  	.set_timeout = ls1x_wdt_set_timeout,
>  };
>  
> -static void ls1x_clk_disable_unprepare(void *data)
> -{
> -	clk_disable_unprepare(data);
> -}
> -
>  static int ls1x_wdt_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> @@ -100,20 +95,10 @@ static int ls1x_wdt_probe(struct platform_device *pdev)
>  	if (IS_ERR(drvdata->base))
>  		return PTR_ERR(drvdata->base);
>  
> -	drvdata->clk = devm_clk_get(dev, pdev->name);
> +	drvdata->clk = devm_clk_get_enabled(dev, pdev->name);
>  	if (IS_ERR(drvdata->clk))
>  		return PTR_ERR(drvdata->clk);
>  
> -	err = clk_prepare_enable(drvdata->clk);
> -	if (err) {
> -		dev_err(dev, "clk enable failed\n");
> -		return err;
> -	}
> -	err = devm_add_action_or_reset(dev, ls1x_clk_disable_unprepare,
> -				       drvdata->clk);
> -	if (err)
> -		return err;
> -
>  	clk_rate = clk_get_rate(drvdata->clk);
>  	if (!clk_rate)
>  		return -EINVAL;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ