diff options
author | Guenter Roeck <linux@roeck-us.net> | 2023-03-04 19:16:07 +0300 |
---|---|---|
committer | Wim Van Sebroeck <wim@linux-watchdog.org> | 2023-04-22 13:53:38 +0300 |
commit | 12cee6efb7b94918747d09ba7488dd5cb1bbe2be (patch) | |
tree | 50fab9b6f5cc05d58a3815c598806a8f31888570 /drivers/watchdog/watchdog_core.c | |
parent | 0ea0a825192efdd44af4c016faaab1a3d2073c78 (diff) | |
download | linux-12cee6efb7b94918747d09ba7488dd5cb1bbe2be.tar.xz |
watchdog: core: Always set WDOG_HW_RUNNING when starting watchdog
The use of WDOG_HW_RUNNING is currently inconsistent: If set by the
driver, it will remain set until the watchdog device is opened and then
closed. If set by the watchdog core, it is only set if the watchdog
can not be stopped when closed. Subsequenty it is always only set while
the watchdog is closed and the hardware watchdog is running.
This is both misleading and inconsistent: The API states that
watchdog_hw_running() indicates that the hardware watchdog is running.
This is currently not always the case. Set WDOG_HW_RUNNING whenever a
watchdog is successfully started for consistent behavior and to
accurately report its status.
This means that we no longer have to check for both watchdog_active()
and watchdog_hw_running() to check if the watchdog is running because
watchdog_hw_running() now implies watchdog_active(). Simplify the code
accordingly where warranted.
Cc: Wang Wensheng <wangwensheng4@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230304161607.1418952-1-linux@roeck-us.net
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Diffstat (limited to 'drivers/watchdog/watchdog_core.c')
-rw-r--r-- | drivers/watchdog/watchdog_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c index c777a612d932..d4c5a736fdcb 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c @@ -162,7 +162,7 @@ static int watchdog_reboot_notifier(struct notifier_block *nb, wdd = container_of(nb, struct watchdog_device, reboot_nb); if (code == SYS_DOWN || code == SYS_HALT) { - if (watchdog_active(wdd) || watchdog_hw_running(wdd)) { + if (watchdog_hw_running(wdd)) { int ret; ret = wdd->ops->stop(wdd); |