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: pic32-dmt: Use devm_clk_get_enabled() helper
Date: Tue, 3 Jan 2023 13:15:12 -0800 [thread overview]
Message-ID: <20230103211512.GD212337@roeck-us.net> (raw)
In-Reply-To: <f9a4dcfc6d31bd9c1417e2d97a40cc2c1dbc6f30.1672496405.git.christophe.jaillet@wanadoo.fr>
On Sat, Dec 31, 2022 at 03:20:29PM +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>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/pic32-dmt.c | 15 +--------------
> 1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/drivers/watchdog/pic32-dmt.c b/drivers/watchdog/pic32-dmt.c
> index f43062b3c4c8..bc4ccddc75a3 100644
> --- a/drivers/watchdog/pic32-dmt.c
> +++ b/drivers/watchdog/pic32-dmt.c
> @@ -164,11 +164,6 @@ static struct watchdog_device pic32_dmt_wdd = {
> .ops = &pic32_dmt_fops,
> };
>
> -static void pic32_clk_disable_unprepare(void *data)
> -{
> - clk_disable_unprepare(data);
> -}
> -
> static int pic32_dmt_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -184,20 +179,12 @@ static int pic32_dmt_probe(struct platform_device *pdev)
> if (IS_ERR(dmt->regs))
> return PTR_ERR(dmt->regs);
>
> - dmt->clk = devm_clk_get(dev, NULL);
> + dmt->clk = devm_clk_get_enabled(dev, NULL);
> if (IS_ERR(dmt->clk)) {
> dev_err(dev, "clk not found\n");
> return PTR_ERR(dmt->clk);
> }
>
> - ret = clk_prepare_enable(dmt->clk);
> - if (ret)
> - return ret;
> - ret = devm_add_action_or_reset(dev, pic32_clk_disable_unprepare,
> - dmt->clk);
> - if (ret)
> - return ret;
> -
> wdd->timeout = pic32_dmt_get_timeout_secs(dmt);
> if (!wdd->timeout) {
> dev_err(dev, "failed to read watchdog register timeout\n");
> --
> 2.34.1
>
prev parent reply other threads:[~2023-01-03 21:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-31 14:20 [PATCH] watchdog: pic32-dmt: Use devm_clk_get_enabled() helper Christophe JAILLET
2023-01-03 21:15 ` Guenter Roeck [this message]
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=20230103211512.GD212337@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.