• Guenter Roeck's avatar
    watchdog: core: Always set WDOG_HW_RUNNING when starting watchdog · 12cee6ef
    Guenter Roeck authored
    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: default avatarGuenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/20230304161607.1418952-1-linux@roeck-us.netSigned-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
    12cee6ef
watchdog_core.c 13 KB