All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luo Yifan" <luoyifan@cmss.chinamobile.com>,
	linux-watchdog@vger.kernel.org
Subject: Re: [PATCH] watchdog: renesas_wdt: avoid sleeping clock calls in restart handler
Date: Tue, 17 Nov 2026 02:20:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-218083@kernel.org> (raw)
In-Reply-To: <20261117020530.19973-1-luoyifan@cmss.chinamobile.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] watchdog: renesas_wdt: missing Fixes trailer for atomic sleep
  fix
- [Low] watchdog: renesas_wdt: use devm_clk_get_prepared() in
  rwdt_probe()
--

commit 4ed48dd9a6e0be55587f40b05e00cb1b9e5da877
Author: Luo Yifan <luoyifan@cmss.chinamobile.com>

> watchdog: renesas_wdt: avoid sleeping clock calls in restart handler
>
> rwdt_restart() runs in atomic context, as the comment above the function
> points out, but it calls clk_prepare_enable().  clk_prepare() may sleep on
> the clock mutex, which is not allowed from a restart handler.
>
> Prepare the clock once in the probe function and only call clk_enable()
> from the restart handler.  clk_enable() does not sleep, so the restart
> path stays atomic.  Unprepare the clock in the probe error path and in
> rwdt_remove().
>
> Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>

[Severity: Low]
Since this fixes the sleeping clk_prepare_enable() call in rwdt_restart(),
should this include a Fixes tag?

  Fixes: fa01fa70039c ("watchdog: renesas_wdt: don't sleep in atomic context")

> diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c
> index d9760f2a3b235..9630d05686461 100644
> --- a/drivers/watchdog/renesas_wdt.c
> +++ b/drivers/watchdog/renesas_wdt.c

[ ... ]

> @@ -233,6 +233,14 @@ static int rwdt_probe(struct platform_device *pdev)
>  	if (IS_ERR(priv->clk))
>  		return PTR_ERR(priv->clk);
>  
> +	/*
> +	 * The restart handler runs in atomic context and can only enable the
> +	 * clock, so prepare it here.
> +	 */
> +	ret = clk_prepare(priv->clk);
> +	if (ret)
> +		return ret;
> +
>  	pm_runtime_enable(dev);
>  	pm_runtime_get_sync(dev);
>  	priv->clk_rate = clk_get_rate(priv->clk);
> @@ -290,6 +298,7 @@ static int rwdt_probe(struct platform_device *pdev)
>  
>   out_pm_disable:
>  	pm_runtime_disable(dev);
> +	clk_unprepare(priv->clk);
>  	return ret;
>  }
>  
> @@ -299,6 +308,7 @@ static void rwdt_remove(struct platform_device *pdev)
>  
>  	watchdog_unregister_device(&priv->wdev);
>  	pm_runtime_disable(&pdev->dev);
> +	clk_unprepare(priv->clk);
>  }

[Severity: Low]
This isn't a bug, but could rwdt_probe() use devm_clk_get_prepared() instead
of devm_clk_get()?  That would prepare priv->clk on acquisition and
automatically unprepare it on probe failure or after rwdt_remove(), avoiding
the manual clk_prepare() and clk_unprepare() calls.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117020530.19973-1-luoyifan@cmss.chinamobile.com?part=1

  reply	other threads:[~2026-11-17  2:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  2:05 [PATCH] watchdog: renesas_wdt: avoid sleeping clock calls in restart handler Luo Yifan
2026-11-17  2:20 ` sashiko-bot [this message]
2026-11-18  1:58   ` 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=sashiko-outbox-218083@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=luoyifan@cmss.chinamobile.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.