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: <ffa8bb97-7764-4463-9ee9-ad2748f32d10@roeck-us.net>
Date:   Tue, 7 Mar 2023 09:51:33 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     Wim Van Sebroeck <wim@...ux-watchdog.org>,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        linux-watchdog@...r.kernel.org
Subject: Re: [PATCH] watchdog: ixp4xx: Use devm_clk_get_enabled() helper

On Sat, Dec 31, 2022 at 12:07:27PM +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 read_cpuid_id() is not defined
> on my system (x86_64).
> So I think that a "depends on ARM<something>" in missing in a KConfig file.
> 
> Fixing it could help compilation farms build-bots.

As mentioned, this not how build dependencies work. The code builds fine
with arm:allmodconfig. It is not enabled with x86_64:allmodconfig since
it depends on ARCH_IXP4XX. It is is not expected to be buildable if
ARCH_IXP4XX is not selected.

Guenter

> ---
>  drivers/watchdog/ixp4xx_wdt.c | 18 +++---------------
>  1 file changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c
> index 281a48d9889f..607ce4b8df57 100644
> --- a/drivers/watchdog/ixp4xx_wdt.c
> +++ b/drivers/watchdog/ixp4xx_wdt.c
> @@ -112,12 +112,6 @@ static const struct watchdog_info ixp4xx_wdt_info = {
>  	.identity = KBUILD_MODNAME,
>  };
>  
> -/* Devres-handled clock disablement */
> -static void ixp4xx_clock_action(void *d)
> -{
> -	clk_disable_unprepare(d);
> -}
> -
>  static int ixp4xx_wdt_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> @@ -139,16 +133,10 @@ static int ixp4xx_wdt_probe(struct platform_device *pdev)
>  	 * Retrieve rate from a fixed clock from the device tree if
>  	 * the parent has that, else use the default clock rate.
>  	 */
> -	clk = devm_clk_get(dev->parent, NULL);
> -	if (!IS_ERR(clk)) {
> -		ret = clk_prepare_enable(clk);
> -		if (ret)
> -			return ret;
> -		ret = devm_add_action_or_reset(dev, ixp4xx_clock_action, clk);
> -		if (ret)
> -			return ret;
> +	clk = devm_clk_get_enabled(dev->parent, NULL);
> +	if (!IS_ERR(clk))
>  		iwdt->rate = clk_get_rate(clk);
> -	}
> +
>  	if (!iwdt->rate)
>  		iwdt->rate = IXP4XX_TIMER_FREQ;
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ