[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56D30BFE.7060805@roeck-us.net>
Date:	Sun, 28 Feb 2016 07:02:22 -0800
From:	Guenter Roeck <linux@...ck-us.net>
To:	Wim Van Sebroeck <wim@...ana.be>,
	One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
Cc:	William Breathitt Gray <vilhelm.gray@...il.com>,
	linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] watchdog: Add watchdog timer support for the
 WinSystems EBC-C384
On 02/28/2016 06:07 AM, Wim Van Sebroeck wrote:
>>> +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) {
>>> +		/* truncate second resolution to minute resolution */
>>> +		t /= 60;
>>> +		wdev->timeout = t * 60;
>>> +
>>> +		/* set watchdog timer for minutes */
>>> +		outb(0x00, CFG_ADDR);
>>
>> If ask for 299 seconds surely I should get 300 not 240 ?
>> (Whether to round off or round up is an interesting question for the
>> middle range - does it go off early or late - I'd have said late but...)
>
> This is my preference:
> 	if (t > 255)
> 		t = (((t - 1) / 60) + 1) * 60;
>
In case I am missing something: Why not just use DIV_ROUND_UP() ?
Thanks,
Guenter
Powered by blists - more mailing lists
 
