Skip to content

Commit cf756a7

Browse files
a3fgregkh
authored andcommitted
watchdog: f71808e_wdt: fix inaccurate report in WDIOC_GETTIMEOUT
[ Upstream commit 164483c735190775f29d0dcbac0363adc51a068d ] The fintek watchdog timer can configure timeouts of second granularity only up to 255 seconds. Beyond that, the timeout needs to be configured with minute granularity. WDIOC_GETTIMEOUT should report the actual timeout configured, not just echo back the timeout configured by the user. Do so. Fixes: 96cb4eb ("watchdog: f71808e_wdt: new watchdog driver for Fintek F71808E and F71882FG") Suggested-by: Guenter Roeck <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Ahmad Fatoum <[email protected]> Link: https://lore.kernel.org/r/5e17960fe8cc0e3cb2ba53de4730b75d9a0f33d5.1628525954.git-series.a.fatoum@pengutronix.de Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent f742386 commit cf756a7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/watchdog/f71808e_wdt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,17 @@ static int watchdog_set_timeout(int timeout)
225225

226226
mutex_lock(&watchdog.lock);
227227

228-
watchdog.timeout = timeout;
229228
if (timeout > 0xff) {
230229
watchdog.timer_val = DIV_ROUND_UP(timeout, 60);
231230
watchdog.minutes_mode = true;
231+
timeout = watchdog.timer_val * 60;
232232
} else {
233233
watchdog.timer_val = timeout;
234234
watchdog.minutes_mode = false;
235235
}
236236

237+
watchdog.timeout = timeout;
238+
237239
mutex_unlock(&watchdog.lock);
238240

239241
return 0;

0 commit comments

Comments
 (0)