Linux Watchdog driver development
 help / color / mirror / Atom feed
* [PATCH] Fix set_timeout for big timeout values
@ 2019-04-06 10:17 Georg Hofmann
  2019-04-06 13:25 ` Guenter Roeck
  0 siblings, 1 reply; 8+ messages in thread
From: Georg Hofmann @ 2019-04-06 10:17 UTC (permalink / raw)
  To: wim; +Cc: linux, linux-watchdog

This patch implements the documented behavior: if max_hw_heartbeat_ms is
implemented, the minimum of the set_timeout argument and
max_hw_heartbeat_ms should be used.
Previously only the first 7 bits were used and the input argument was
returned.

Signed-off-by: Georg Hofmann <georg@hofmannsweb.com>
---
 drivers/watchdog/imx2_wdt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 2b52514..3c13adc 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -178,9 +178,11 @@ static void __imx2_wdt_set_timeout(struct watchdog_device *wdog,
 static int imx2_wdt_set_timeout(struct watchdog_device *wdog,
 				unsigned int new_timeout)
 {
-	__imx2_wdt_set_timeout(wdog, new_timeout);
+	unsigned int actual;
 
-	wdog->timeout = new_timeout;
+	actual = min(new_timeout, wdog->max_hw_heartbeat_ms * 1000);
+	__imx2_wdt_set_timeout(wdog, actual);
+	wdog->timeout = actual;
 	return 0;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH] Fix set_timeout for big timeout values
@ 2019-04-08  8:05 Georg Hofmann
  2019-04-08 18:09 ` Guenter Roeck
  2019-04-08 18:15 ` Guenter Roeck
  0 siblings, 2 replies; 8+ messages in thread
From: Georg Hofmann @ 2019-04-08  8:05 UTC (permalink / raw)
  To: wim; +Cc: linux, linux-watchdog

This patch implements the documented behavior: if max_hw_heartbeat_ms is
implemented, the minimum of the set_timeout argument and
max_hw_heartbeat_ms should be used.
Previously only the first 7 bits were used and the input argument was
returned.

Signed-off-by: Georg Hofmann <georg@hofmannsweb.com>
---
 drivers/watchdog/imx2_wdt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 2b52514..3c13adc 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -178,9 +178,11 @@ static void __imx2_wdt_set_timeout(struct watchdog_device *wdog,
 static int imx2_wdt_set_timeout(struct watchdog_device *wdog,
                                 unsigned int new_timeout)
 {
-        __imx2_wdt_set_timeout(wdog, new_timeout);
+        unsigned int actual;
 
-        wdog->timeout = new_timeout;
+        actual = min(new_timeout, wdog->max_hw_heartbeat_ms * 1000);
+        __imx2_wdt_set_timeout(wdog, actual);

+        wdog->timeout = new_timeout;
         return 0;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-04-08 18:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-06 10:17 [PATCH] Fix set_timeout for big timeout values Georg Hofmann
2019-04-06 13:25 ` Guenter Roeck
2019-04-06 14:17   ` Georg Hofmann
2019-04-06 15:46     ` Guenter Roeck
2019-04-06 16:26       ` Georg Hofmann
  -- strict thread matches above, loose matches on Subject: below --
2019-04-08  8:05 Georg Hofmann
2019-04-08 18:09 ` Guenter Roeck
2019-04-08 18:15 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox