From: Guenter Roeck <linux@roeck-us.net>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-watchdog@vger.kernel.org
Subject: Re: [PATCH] watchdog: ixp4xx: Use devm_clk_get_enabled() helper
Date: Sat, 31 Dec 2022 15:14:51 -0800 [thread overview]
Message-ID: <20221231231451.GD2706156@roeck-us.net> (raw)
In-Reply-To: <5d04e453a4da5cfafb56695a17157fa3ea296511.1672484831.git.christophe.jaillet@wanadoo.fr>
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@wanadoo.fr>
> ---
> 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.
It has
depends on ARCH_IXP4XX
and CONFIG_IXP4XX_WATCHDOG is not set for me after "make allmodconfig".
>
> Fixing it could help compilation farms build-bots.
Mine doesn't see a problem, and I don't recall ever being alerted about
one. What am I missing ? Do you see a problem reported anywhere ?
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;
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2022-12-31 23:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-31 11:07 [PATCH] watchdog: ixp4xx: Use devm_clk_get_enabled() helper Christophe JAILLET
2022-12-31 23:14 ` Guenter Roeck [this message]
2023-01-01 9:35 ` Christophe JAILLET
2023-01-01 15:07 ` Guenter Roeck
2023-01-01 17:52 ` Christophe JAILLET
2023-01-01 19:31 ` Guenter Roeck
2023-03-07 17:51 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221231231451.GD2706156@roeck-us.net \
--to=linux@roeck-us.net \
--cc=christophe.jaillet@wanadoo.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).