From: Meng Li Date: Mon, 14 Aug 2023 09:06:16 +0000 (+0800) Subject: watchdog: core: stop watchdog when executing poweroff command X-Git-Tag: v6.6.17~3980^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=486a64b29c5f43a9671713e781779863dda9bbc9;p=platform%2Fkernel%2Flinux-rpi.git 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 Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20230814090616.1853263-1-Meng.Li@windriver.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c index d4c5a73..5b55cca 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c @@ -161,7 +161,7 @@ static int watchdog_reboot_notifier(struct notifier_block *nb, struct watchdog_device *wdd; wdd = container_of(nb, struct watchdog_device, reboot_nb); - if (code == SYS_DOWN || code == SYS_HALT) { + if (code == SYS_DOWN || code == SYS_HALT || code == SYS_POWER_OFF) { if (watchdog_hw_running(wdd)) { int ret;