提交 1e935949 编写于 作者: G Guenter Roeck 提交者: Wim Van Sebroeck

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: NGuenter Roeck <linux@roeck-us.net>
Acked-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: NWim Van Sebroeck <wim@iguana.be>
上级 8cbb97ea
...@@ -119,8 +119,15 @@ static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool noway ...@@ -119,8 +119,15 @@ static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool noway
/* Use the following function to check if a timeout value is invalid */ /* Use the following function to check if a timeout value is invalid */
static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigned int t) static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigned int t)
{ {
return ((wdd->max_timeout != 0) && /*
(t < wdd->min_timeout || t > wdd->max_timeout)); * The timeout is invalid if
* - the requested value is smaller than the configured minimum timeout,
* or
* - a maximum timeout is configured, and the requested value is larger
* than the maximum timeout.
*/
return t < wdd->min_timeout ||
(wdd->max_timeout && t > wdd->max_timeout);
} }
/* Use the following functions to manipulate watchdog driver specific data */ /* Use the following functions to manipulate watchdog driver specific data */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册