diff options
author | Guenter Roeck <linux@roeck-us.net> | 2015-09-29 04:27:24 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2015-11-03 08:34:22 -0500 |
commit | 1e935949111e77b2b1b6fa550e88ff0573c2f4c7 (patch) | |
tree | a187cd45cb91719d4843817cb886756823152ef2 | |
parent | 8cbb97ea3e386eb95ecbd99260d681792963cebf (diff) |
watchdog: Always evaluate new timeout against min_timeout
Up to now, a new timeout value is only evaluated against min_timeout
if max_timeout is provided. This does not really make sense; a driver
can have a minimum timeout even if it does not have a maximum timeout.
Ensure that it is not smaller than min_timeout, even if max_timeout
is not set.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | include/linux/watchdog.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index d74a0e907b9e..e90e3ea5ebeb 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h | |||
@@ -119,8 +119,15 @@ static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool noway | |||
119 | /* Use the following function to check if a timeout value is invalid */ | 119 | /* Use the following function to check if a timeout value is invalid */ |
120 | static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigned int t) | 120 | static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigned int t) |
121 | { | 121 | { |
122 | return ((wdd->max_timeout != 0) && | 122 | /* |
123 | (t < wdd->min_timeout || t > wdd->max_timeout)); | 123 | * The timeout is invalid if |
124 | * - the requested value is smaller than the configured minimum timeout, | ||
125 | * or | ||
126 | * - a maximum timeout is configured, and the requested value is larger | ||
127 | * than the maximum timeout. | ||
128 | */ | ||
129 | return t < wdd->min_timeout || | ||
130 | (wdd->max_timeout && t > wdd->max_timeout); | ||
124 | } | 131 | } |
125 | 132 | ||
126 | /* Use the following functions to manipulate watchdog driver specific data */ | 133 | /* Use the following functions to manipulate watchdog driver specific data */ |