From: Guenter Roeck <linux@roeck-us.net>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Keguang Zhang <keguang.zhang@gmail.com>,
Wim Van Sebroeck <wim@linux-watchdog.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-mips@vger.kernel.org, linux-watchdog@vger.kernel.org
Subject: Re: [PATCH] watchdog: loongson1: Use devm_clk_get_enabled() helper
Date: Sat, 31 Dec 2022 15:16:41 -0800 [thread overview]
Message-ID: <20221231231641.GE2706156@roeck-us.net> (raw)
In-Reply-To: <624106aa86ef7e49f16b11b229528eabd63de8f7.1672485257.git.christophe.jaillet@wanadoo.fr>
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@wanadoo.fr>
> ---
> 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.
>
> Fixing it could help compilation farms build-bots.
Why would
depends on MACH_LOONGSON32
be insufficient ?
Not reviewing the series further until this is resolved. It looks like
I am missing something serious.
Guenter
> ---
> 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;
> --
> 2.34.1
>
next prev parent reply other threads:[~2022-12-31 23:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-31 11:14 Christophe JAILLET
2022-12-31 23:16 ` Guenter Roeck [this message]
2023-03-07 17:55 ` 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=20221231231641.GE2706156@roeck-us.net \
--to=linux@roeck-us.net \
--cc=christophe.jaillet@wanadoo.fr \
--cc=keguang.zhang@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@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
all inboxes | Powered by JetHome®