From: Georg Hofmann <georg@hofmannsweb.com>
To: wim@linux-watchdog.org
Cc: linux@roeck-us.net, linux-watchdog@vger.kernel.org
Subject: [PATCH] Fix set_timeout for big timeout values
Date: Sat, 6 Apr 2019 12:17:43 +0200 (CEST) [thread overview]
Message-ID: <1274287303.1911.1554545863744.JavaMail.zimbra@hofmannsweb.com> (raw)
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
next reply other threads:[~2019-04-06 10:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-06 10:17 Georg Hofmann [this message]
2019-04-06 13:25 ` [PATCH] Fix set_timeout for big timeout values 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
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=1274287303.1911.1554545863744.JavaMail.zimbra@hofmannsweb.com \
--to=georg@hofmannsweb.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=wim@linux-watchdog.org \
/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