mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-watchdog@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] watchdog: imx7ulp: Use devm_clk_get_enabled() helper
Date: Sat, 31 Dec 2022 15:10:43 -0800	[thread overview]
Message-ID: <20221231231043.GC2706156@roeck-us.net> (raw)
In-Reply-To: <f23a2cf84958adca255b82fd688e7cee0461760f.1672484376.git.christophe.jaillet@wanadoo.fr>

On Sat, Dec 31, 2022 at 11:59:57AM +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/imx7ulp_wdt.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c
> index 2897902090b3..7ca486794ba7 100644
> --- a/drivers/watchdog/imx7ulp_wdt.c
> +++ b/drivers/watchdog/imx7ulp_wdt.c
> @@ -299,11 +299,6 @@ static int imx7ulp_wdt_init(struct imx7ulp_wdt_device *wdt, unsigned int timeout
>  	return ret;
>  }
>  
> -static void imx7ulp_wdt_action(void *data)
> -{
> -	clk_disable_unprepare(data);
> -}
> -
>  static int imx7ulp_wdt_probe(struct platform_device *pdev)
>  {
>  	struct imx7ulp_wdt_device *imx7ulp_wdt;
> @@ -321,7 +316,7 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev)
>  	if (IS_ERR(imx7ulp_wdt->base))
>  		return PTR_ERR(imx7ulp_wdt->base);
>  
> -	imx7ulp_wdt->clk = devm_clk_get(dev, NULL);
> +	imx7ulp_wdt->clk = devm_clk_get_enabled(dev, NULL);
>  	if (IS_ERR(imx7ulp_wdt->clk)) {
>  		dev_err(dev, "Failed to get watchdog clock\n");
>  		return PTR_ERR(imx7ulp_wdt->clk);
> @@ -336,14 +331,6 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev)
>  		dev_info(dev, "imx7ulp wdt probe\n");
>  	}
>  
> -	ret = clk_prepare_enable(imx7ulp_wdt->clk);
> -	if (ret)
> -		return ret;
> -
> -	ret = devm_add_action_or_reset(dev, imx7ulp_wdt_action, imx7ulp_wdt->clk);
> -	if (ret)
> -		return ret;
> -
>  	wdog = &imx7ulp_wdt->wdd;
>  	wdog->info = &imx7ulp_wdt_info;
>  	wdog->ops = &imx7ulp_wdt_ops;
> -- 
> 2.34.1
> 

      reply	other threads:[~2022-12-31 23:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-31 10:59 Christophe JAILLET
2022-12-31 23:10 ` 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=20221231231043.GC2706156@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=festevam@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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®