All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watchdog: sp805_wdt: fix suspend/resume handling of HW_RUNNING watchdog
@ 2026-09-11  3:05 Li Jun
  2026-09-11  3:19 ` sashiko-bot
  2026-09-11  3:39 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Li Jun @ 2026-09-11  3:05 UTC (permalink / raw)
  To: lijun01, wim, linux, linux-watchdog

sp805_wdt_suspend() and sp805_wdt_resume() only check watchdog_active(),
when the watchdog is left running by the driver sets
WDOG_HW_RUNNING in sp805_wdt_probe() but userspace never opens the
device, so WDOG_ACTIVE remains cleared, the wdt_disable() will not be
executed in sp805_wdt_suspend. In this case, the suspend callback is
a no-op and the watchdog keeps counting during system suspend,
leading to an unexpected system reset.
Check WDOG_HW_RUNNING and wdt->wdd,can fix this issue.

Signed-off-by: Li Jun <lijun01@kylinos.cn>
---
 drivers/watchdog/sp805_wdt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index c2125f204a13..2ddb754f3b4a 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -325,7 +325,8 @@ static int __maybe_unused sp805_wdt_suspend(struct device *dev)
 {
 	struct sp805_wdt *wdt = dev_get_drvdata(dev);
 
-	if (watchdog_active(&wdt->wdd))
+	if (watchdog_active(&wdt->wdd) ||
+	    watchdog_hw_running(&wdt->wdd))
 		return wdt_disable(&wdt->wdd);
 
 	return 0;
@@ -335,7 +336,8 @@ static int __maybe_unused sp805_wdt_resume(struct device *dev)
 {
 	struct sp805_wdt *wdt = dev_get_drvdata(dev);
 
-	if (watchdog_active(&wdt->wdd))
+	if (watchdog_active(&wdt->wdd) ||
+	    watchdog_hw_running(&wdt->wdd))
 		return wdt_enable(&wdt->wdd);
 
 	return 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-11  3:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-11  3:05 [PATCH] watchdog: sp805_wdt: fix suspend/resume handling of HW_RUNNING watchdog Li Jun
2026-09-11  3:19 ` sashiko-bot
2026-09-11  3:39 ` Guenter Roeck

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.