On some platforms, for example, NXP ls1028 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...@windriver.com>
---
 drivers/watchdog/watchdog_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index c777a612d932..401d5d4db3fe 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_active(wdd) || watchdog_hw_running(wdd)) {
                        int ret;
 
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12970): 
https://lists.yoctoproject.org/g/linux-yocto/message/12970
Mute This Topic: https://lists.yoctoproject.org/mt/100735102/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to