mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@amd.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Michal Simek <michal.simek@xilinx.com>,
	"Goud, Srinivas" <srinivas.goud@amd.com>,
	"Neeli, Srinivas" <srinivas.neeli@amd.com>
Cc: <linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>,
	<linux-watchdog@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2] watchdog: of_xilinx_wdt: Use devm_clk_get_enabled() helper
Date: Mon, 2 Jan 2023 11:54:52 +0100	[thread overview]
Message-ID: <df5fcc0c-c690-f213-6bd4-57806ea6b67e@amd.com> (raw)
In-Reply-To: <2b041dc8230a4ed255051bb2d323da8a51a8d0be.1672491445.git.christophe.jaillet@wanadoo.fr>

++

On 12/31/22 13:57, 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>
> ---
> V2: remove xwdt_clk_disable_unprepare() as-well
> 
> Note that the order of operations is slightly modified by this patch. The
> clk is now prepare_enable()'ed before calling clk_get_rate().
> ---
>   drivers/watchdog/of_xilinx_wdt.c | 16 +---------------
>   1 file changed, 1 insertion(+), 15 deletions(-)
> 
> diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
> index 3318544366b8..2a079ca04aa3 100644
> --- a/drivers/watchdog/of_xilinx_wdt.c
> +++ b/drivers/watchdog/of_xilinx_wdt.c
> @@ -154,11 +154,6 @@ static u32 xwdt_selftest(struct xwdt_device *xdev)
>                  return XWT_TIMER_FAILED;
>   }
> 
> -static void xwdt_clk_disable_unprepare(void *data)
> -{
> -       clk_disable_unprepare(data);
> -}
> -
>   static int xwdt_probe(struct platform_device *pdev)
>   {
>          struct device *dev = &pdev->dev;
> @@ -193,7 +188,7 @@ static int xwdt_probe(struct platform_device *pdev)
> 
>          watchdog_set_nowayout(xilinx_wdt_wdd, enable_once);
> 
> -       xdev->clk = devm_clk_get(dev, NULL);
> +       xdev->clk = devm_clk_get_enabled(dev, NULL);
>          if (IS_ERR(xdev->clk)) {
>                  if (PTR_ERR(xdev->clk) != -ENOENT)
>                          return PTR_ERR(xdev->clk);
> @@ -211,15 +206,6 @@ static int xwdt_probe(struct platform_device *pdev)
>                                   "The watchdog clock freq cannot be obtained\n");
>          } else {
>                  pfreq = clk_get_rate(xdev->clk);
> -               rc = clk_prepare_enable(xdev->clk);
> -               if (rc) {
> -                       dev_err(dev, "unable to enable clock\n");
> -                       return rc;
> -               }
> -               rc = devm_add_action_or_reset(dev, xwdt_clk_disable_unprepare,
> -                                             xdev->clk);
> -               if (rc)
> -                       return rc;
>          }
> 
>          /*
> --
> 2.34.1
> 

Srinivas: Please retest but it looks good to me.

Acked-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal


  reply	other threads:[~2023-01-02 10:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-31 12:57 Christophe JAILLET
2023-01-02 10:54 ` Michal Simek [this message]
2023-01-03 21:14 ` 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=df5fcc0c-c690-f213-6bd4-57806ea6b67e@amd.com \
    --to=michal.simek@amd.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=michal.simek@xilinx.com \
    --cc=srinivas.goud@amd.com \
    --cc=srinivas.neeli@amd.com \
    --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®