Hi William,

On Sun, Feb 28, 2016 at 11:29:10PM -0500, William Breathitt Gray wrote:
> The WinSystems EBC-C384 has an onboard watchdog timer. The timeout range
> supported by the watchdog timer is 1 second to 255 minutes. Timeouts
> under 256 seconds have a 1 second granularity, while the rest have a 1
> minute granularity.
> 
> This driver adds watchdog timer support for this onboard watchdog timer.
> The timeout may be configured via the timeout module parameter.
> 
> Signed-off-by: William Breathitt Gray <vilhelm.g...@gmail.com>
> Reviewed-by: Guenter Roeck <li...@roeck-us.net>
> ---
>  MAINTAINERS                     |   6 ++
>  drivers/watchdog/Kconfig        |   9 ++
>  drivers/watchdog/Makefile       |   1 +
>  drivers/watchdog/ebc-c384_wdt.c | 188 
> ++++++++++++++++++++++++++++++++++++++++
> 
[ ... ]

> +
> +static int ebc_c384_wdt_set_timeout(struct watchdog_device *wdev, unsigned t)
> +{
> +     /* resolution is in minutes for timeouts greater than 255 seconds */
> +     if (t > 255) {
> +             /* round second resolution up to minute granularity */
> +             wdev->timeout = DIV_ROUND_UP(t, 60) * 60;

Good catch.

Turns out there is a much better macro for this:
                wdev->timeout = roundup(t, 60);

Guenter

Reply via email to