[PATCH v2 3/3] watchdog: pretimeout: record PSC reason on watchdog pretimeout

Faruque Ansari <[email protected]> Wed, 22 Jul 2026 20:43:02 +0530
Newsgroups org.kernel.vger.linux-watchdog,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm
Message-ID <[email protected]>
Update the PSC reset reason by invoking set_psc_reason(PSCR_WATCHDOG_PRETIMEOUT)
from watchdog_notify_pretimeout() before either the panic or noop governor
runs, so the reset cause is committed to persistent storage before the
system goes down.

Signed-off-by: Faruque Ansari <[email protected]>
---
 drivers/watchdog/watchdog_pretimeout.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/watchdog/watchdog_pretimeout.c b/drivers/watchdog/watchdog_pretimeout.c
index 02e09b9e396d..ea48d4eca4aa 100644
--- a/drivers/watchdog/watchdog_pretimeout.c
+++ b/drivers/watchdog/watchdog_pretimeout.c
@@ -4,6 +4,7 @@
  */
 
 #include <linux/list.h>
+#include <linux/reboot.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/string.h>
@@ -103,6 +104,8 @@ void watchdog_notify_pretimeout(struct watchdog_device *wdd)
 {
 	unsigned long flags;
 
+	set_psc_reason(PSCR_WATCHDOG_PRETIMEOUT);
+
 	spin_lock_irqsave(&pretimeout_lock, flags);
 	if (!wdd->gov) {
 		spin_unlock_irqrestore(&pretimeout_lock, flags);

-- 
2.34.1