watchdog: renesas_wdt: apply better precision
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Wed, 19 Jul 2017 08:27:54 +0000 (10:27 +0200)
committerWim Van Sebroeck <wim@iguana.be>
Sat, 9 Sep 2017 18:23:19 +0000 (20:23 +0200)
commit82f64cd20848511f516bd28147a6432497dfb080
treea0abd69e25cd929b51310197b16c7db552cc7d5e
parent1c1b2434017206b612764fad1820b6dd48cb9e92
watchdog: renesas_wdt: apply better precision

The error margin of the clks_per_second variable was too large and
caused offsets when used with clock frequencies which left a remainder
after applying the dividers. Now we always calculate directly using the
clock rate and the divider using some helper macros. That also means
that DIV_ROUND_UP moves from probe to the multiplication macro. In
probe, we don't need to ensure anymore that 'clks_per_sec' would go too
fast but rather ensure that the lower limit is really at least 1 to
certainly get a full cycle.

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