|
@@ -92,9 +92,13 @@ static inline bool watchdog_need_worker(struct watchdog_device *wdd)
|
|
|
* thus is aware that the framework supports generating heartbeat
|
|
* thus is aware that the framework supports generating heartbeat
|
|
|
* requests.
|
|
* requests.
|
|
|
* - Userspace requests a longer timeout than the hardware can handle.
|
|
* - Userspace requests a longer timeout than the hardware can handle.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Alternatively, if userspace has not opened the watchdog
|
|
|
|
|
+ * device, we take care of feeding the watchdog if it is
|
|
|
|
|
+ * running.
|
|
|
*/
|
|
*/
|
|
|
- return hm && ((watchdog_active(wdd) && t > hm) ||
|
|
|
|
|
- (t && !watchdog_active(wdd) && watchdog_hw_running(wdd)));
|
|
|
|
|
|
|
+ return (hm && watchdog_active(wdd) && t > hm) ||
|
|
|
|
|
+ (t && !watchdog_active(wdd) && watchdog_hw_running(wdd));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static long watchdog_next_keepalive(struct watchdog_device *wdd)
|
|
static long watchdog_next_keepalive(struct watchdog_device *wdd)
|
|
@@ -107,7 +111,7 @@ static long watchdog_next_keepalive(struct watchdog_device *wdd)
|
|
|
unsigned int hw_heartbeat_ms;
|
|
unsigned int hw_heartbeat_ms;
|
|
|
|
|
|
|
|
virt_timeout = wd_data->last_keepalive + msecs_to_jiffies(timeout_ms);
|
|
virt_timeout = wd_data->last_keepalive + msecs_to_jiffies(timeout_ms);
|
|
|
- hw_heartbeat_ms = min(timeout_ms, wdd->max_hw_heartbeat_ms);
|
|
|
|
|
|
|
+ hw_heartbeat_ms = min_not_zero(timeout_ms, wdd->max_hw_heartbeat_ms);
|
|
|
keepalive_interval = msecs_to_jiffies(hw_heartbeat_ms / 2);
|
|
keepalive_interval = msecs_to_jiffies(hw_heartbeat_ms / 2);
|
|
|
|
|
|
|
|
if (!watchdog_active(wdd))
|
|
if (!watchdog_active(wdd))
|