Skip to content

Commit 486a64b

Browse files
limeng-linuxWim Van Sebroeck
authored andcommitted
watchdog: core: stop watchdog when executing poweroff command
On some platforms, for example, Intel SoC FPGA platform, the watchdog is started in u-boot, and so kernel will create a timer and work to keep watchdog alive. But when user executes commands "poweroff" or "shutdown -h", the system is reset when watchdog triggers timeout even if WDOG_STOP_ON_REBOOT is set in watchdog driver. The root cause is that the watchdog is not stopped properly because the SYS_POWER_OFF case is not supported in notify callback function. So, add this case to stop watchdog when executing poweroff command. Signed-off-by: Meng Li <Meng.Li@windriver.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20230814090616.1853263-1-Meng.Li@windriver.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
1 parent 89e5e28 commit 486a64b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/watchdog/watchdog_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static int watchdog_reboot_notifier(struct notifier_block *nb,
161161
struct watchdog_device *wdd;
162162

163163
wdd = container_of(nb, struct watchdog_device, reboot_nb);
164-
if (code == SYS_DOWN || code == SYS_HALT) {
164+
if (code == SYS_DOWN || code == SYS_HALT || code == SYS_POWER_OFF) {
165165
if (watchdog_hw_running(wdd)) {
166166
int ret;
167167

0 commit comments

Comments
 (0)