Commit 81a0eaaa authored by Georg Hofmann's avatar Georg Hofmann Committed by Greg Kroah-Hartman

watchdog: imx2_wdt: Fix set_timeout for big timeout values

[ Upstream commit b07e228e ]

The documentated behavior is: if max_hw_heartbeat_ms is implemented, the
minimum of the set_timeout argument and max_hw_heartbeat_ms should be used.
This patch implements this behavior.
Previously only the first 7bits were used and the input argument was
returned.
Signed-off-by: default avatarGeorg Hofmann <georg@hofmannsweb.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 1f468942
......@@ -178,8 +178,10 @@ 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;
actual = min(new_timeout, wdog->max_hw_heartbeat_ms * 1000);
__imx2_wdt_set_timeout(wdog, actual);
wdog->timeout = new_timeout;
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment