watchdog: imx2_wdt: Fix set_timeout for big timeout values
Subsystems (2)
PATCH v2 1/1 watchdog: imx2_wdt: Fix set_timeout for big timeout values
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 Georg Hofmann <[email protected]>
--- drivers/watchdog/imx2_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/watchdog/imx2_wdt.c +3 -1
@@ -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 ; }
Signature · 1 line
2.7.4
Quoted 7 lines · Georg Hofmann
The documentated behavior is: if
max_hw_heartbeat_msis implemented, the minimum of theset_timeoutargument andmax_hw_heartbeat_msshould be used. This patch implements this behavior.
Previously only the first 7bits were used and the input argument was returned.Signed-off-by Georg Hofmann <[email protected]>
This time it applied, thanks.
Reviewed-by Guenter Roeck <[email protected]>
Guenter
Quoted 20 lines
--- drivers/watchdog/imx2_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/watchdog/imx2_wdt.c +3
-1@@ -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 ; }