watchdog: renesas_wdt: don't round closest with get_timeleft
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Wed, 19 Jul 2017 08:27:53 +0000 (10:27 +0200)
committerWim Van Sebroeck <wim@iguana.be>
Sat, 9 Sep 2017 18:23:14 +0000 (20:23 +0200)
We should never return more time left than there actually is. So, switch
to a plain divider instead of DIV_ROUND_CLOSEST.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
drivers/watchdog/renesas_wdt.c

index 8437dd521532089583c9c71ad1070bfafc47b521..3763437cd0b0154f629a035079984efd0be335bb 100644 (file)
@@ -92,7 +92,7 @@ static unsigned int rwdt_get_timeleft(struct watchdog_device *wdev)
        struct rwdt_priv *priv = watchdog_get_drvdata(wdev);
        u16 val = readw_relaxed(priv->base + RWTCNT);
 
-       return DIV_ROUND_CLOSEST(65536 - val, priv->clks_per_sec);
+       return (65536 - val) / priv->clks_per_sec;
 }
 
 static const struct watchdog_info rwdt_ident = {