From: Wolfram Sang Date: Wed, 19 Jul 2017 08:27:53 +0000 (+0200) Subject: watchdog: renesas_wdt: don't round closest with get_timeleft X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1c1b2434017206b612764fad1820b6dd48cb9e92;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git watchdog: renesas_wdt: don't round closest with get_timeleft 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 Reviewed-by: Guenter Roeck Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c index 8437dd521532..3763437cd0b0 100644 --- a/drivers/watchdog/renesas_wdt.c +++ b/drivers/watchdog/renesas_wdt.c @@ -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 = {