public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: linux-watchdog@vger.kernel.org
Cc: "Wim Van Sebroeck" <wim@iguana.be>,
	linux-kernel@vger.kernel.org,
	"Timo Kokkonen" <timo.kokkonen@offcode.fi>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	linux-doc@vger.kernel.org, "Jonathan Corbet" <corbet@lwn.net>,
	"Guenter Roeck" <linux@roeck-us.net>
Subject: [PATCH v3 9/9] watchdog: Always evaluate new timeout against min_timeout
Date: Sat, 29 Aug 2015 12:32:38 -0700	[thread overview]
Message-ID: <1440876758-28047-10-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1440876758-28047-1-git-send-email-linux@roeck-us.net>

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>
---
v3: New patch
---
 include/linux/watchdog.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 5c7d0e9e1f3f..0d95b3a21556 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -141,9 +141,9 @@ 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 t > UINT_MAX / 1000 ||
+	return t > UINT_MAX / 1000 || t < wdd->min_timeout ||
 		(!wdd->max_hw_timeout_ms && wdd->max_timeout &&
-		 (t < wdd->min_timeout || t > wdd->max_timeout));
+		 t > wdd->max_timeout);
 }
 
 /* Use the following functions to manipulate watchdog driver specific data */
-- 
2.1.4


      parent reply	other threads:[~2015-08-29 19:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-29 19:32 [PATCH v3 0/9] watchdog: Add support for keepalives triggered by infrastructure Guenter Roeck
2015-08-29 19:32 ` [PATCH v3 1/9] watchdog: watchdog_dev: Use single variable name for struct watchdog_device Guenter Roeck
2015-08-29 19:32 ` [PATCH v3 2/9] watchdog: Introduce hardware maximum timeout in watchdog core Guenter Roeck
2015-09-08 10:33   ` Uwe Kleine-König
2015-09-08 13:47     ` Guenter Roeck
2015-09-08 20:03       ` Uwe Kleine-König
2015-09-08 21:07         ` Guenter Roeck
2015-09-09  7:59           ` Uwe Kleine-König
2015-08-29 19:32 ` [PATCH v3 3/9] watchdog: Introduce WDOG_RUNNING flag Guenter Roeck
2015-08-29 19:32 ` [PATCH v3 4/9] watchdog: Make set_timeout function optional Guenter Roeck
2015-08-29 19:32 ` [PATCH v3 5/9] watchdog: imx2: Convert to use infrastructure triggered keepalives Guenter Roeck
2015-08-29 19:32 ` [PATCH v3 6/9] watchdog: retu: " Guenter Roeck
2015-08-29 19:32 ` [PATCH v3 7/9] watchdog: gpio_wdt: " Guenter Roeck
2015-08-29 19:32 ` [PATCH v3 8/9] watchdog: at91sam9: " Guenter Roeck
2015-08-29 19:32 ` Guenter Roeck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1440876758-28047-10-git-send-email-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=timo.kokkonen@offcode.fi \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox