Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234808 > unrolled thread

[PATCH v4 1/9] watchdog: Always evaluate new timeout against min_timeout

Started byGuenter Roeck <linux@roeck-us.net>
First post2015-09-29 10:30 +0200
Last post2015-09-29 11:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v4 1/9] watchdog: Always evaluate new timeout against min_timeout Guenter Roeck <linux@roeck-us.net> - 2015-09-29 10:30 +0200
    Re: [PATCH v4 1/9] watchdog: Always evaluate new timeout against  min_timeout Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2015-09-29 11:00 +0200

#1234808 — [PATCH v4 1/9] watchdog: Always evaluate new timeout against min_timeout

FromGuenter Roeck <linux@roeck-us.net>
Date2015-09-29 10:30 +0200
Subject[PATCH v4 1/9] watchdog: Always evaluate new timeout against min_timeout
Message-ID<qdYsq-10X-3@gated-at.bofh.it>
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>
---
v4: Now first patch of series.
    Added comments.
v3: New patch.
---
 include/linux/watchdog.h | 11 +++++++++--
 1 file 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
 /* 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)
 {
-	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 */
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1234868 — Re: [PATCH v4 1/9] watchdog: Always evaluate new timeout against min_timeout

FromUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date2015-09-29 11:00 +0200
SubjectRe: [PATCH v4 1/9] watchdog: Always evaluate new timeout against min_timeout
Message-ID<qdYVs-1z1-13@gated-at.bofh.it>
In reply to#1234808
On Tue, Sep 29, 2015 at 01:27:24AM -0700, Guenter Roeck wrote:
> 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>

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web