mirror of
https://gitee.com/open-loongarch/linux-6.12.git
synced 2026-10-28 05:57:12 +08:00
drivers: watchdog: support setup watchdog timeout when close enable watchdog
Changelog: 看门狗驱动支持在关机调用看门狗时设置超时时间 Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
This commit is contained in:
@@ -47,6 +47,15 @@ config WATCHDOG_NOWAYOUT
|
||||
get killed. If you say Y here, the watchdog cannot be stopped once
|
||||
it has been started.
|
||||
|
||||
config WATCHDOG_TIMEOUT_ON_CLOSE
|
||||
int "Timeout value for opening watchdog device"
|
||||
default 5
|
||||
depends on !WATCHDOG_NOWAYOUT
|
||||
help
|
||||
if not WATCHDOG_NOWAYOUT, mean setup watchdog daemon when poweroff
|
||||
so this option is second about watchdog timeout.
|
||||
if setup <= 0 mean not setup watchdog timeout. but ping watchdog also will exec
|
||||
|
||||
config WATCHDOG_HANDLE_BOOT_ENABLED
|
||||
bool "Update boot-enabled watchdog until userspace takes over"
|
||||
default y
|
||||
|
||||
@@ -966,6 +966,10 @@ static int watchdog_release(struct inode *inode, struct file *file)
|
||||
/* If the watchdog was not stopped, send a keepalive ping */
|
||||
if (err < 0) {
|
||||
pr_crit("watchdog%d: watchdog did not stop!\n", wdd->id);
|
||||
#ifdef CONFIG_WATCHDOG_TIMEOUT_ON_CLOSE
|
||||
if (wdd->ops->set_timeout && CONFIG_WATCHDOG_TIMEOUT_ON_CLOSE > 0)
|
||||
wdd->ops->set_timeout(wdd, CONFIG_WATCHDOG_TIMEOUT_ON_CLOSE);
|
||||
#endif
|
||||
watchdog_ping(wdd);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user