瀏覽代碼

watchdog: add support for resetting keepalive timers at start

Current watchdog core pets the timer always after the initial keepalive
time has expired from boot-up. This is incorrect for certain timers that
don't like to be petted immediately when they are started, if they have
not been running over the boot.

To allow drivers to reset their keepalive timers during startup, add
a new watchdog flag to the api, WDOG_RESET_KEEPALIVE.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Tero Kristo 6 年之前
父節點
當前提交
66e8b8e952
共有 2 個文件被更改,包括 3 次插入0 次删除
  1. 2 0
      drivers/watchdog/watchdog_dev.c
  2. 1 0
      include/linux/watchdog.h

+ 2 - 0
drivers/watchdog/watchdog_dev.c

@@ -267,6 +267,8 @@ static int watchdog_start(struct watchdog_device *wdd)
 		set_bit(WDOG_ACTIVE, &wdd->status);
 		wd_data->last_keepalive = started_at;
 		watchdog_update_worker(wdd);
+		if (test_bit(WDOG_RESET_KEEPALIVE, &wdd->status))
+			wd_data->last_hw_keepalive = started_at;
 	}
 
 	return err;

+ 1 - 0
include/linux/watchdog.h

@@ -119,6 +119,7 @@ struct watchdog_device {
 #define WDOG_STOP_ON_REBOOT	2	/* Should be stopped on reboot */
 #define WDOG_HW_RUNNING		3	/* True if HW watchdog running */
 #define WDOG_STOP_ON_UNREGISTER	4	/* Should be stopped on unregister */
+#define WDOG_RESET_KEEPALIVE	5	/* Reset keepalive timers at start */
 	struct list_head deferred;
 };