All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Wim Van Sebroeck <wim@iguana.be>,
	One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: William Breathitt Gray <vilhelm.gray@gmail.com>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] watchdog: Add watchdog timer support for the WinSystems EBC-C384
Date: Sun, 28 Feb 2016 07:02:22 -0800	[thread overview]
Message-ID: <56D30BFE.7060805@roeck-us.net> (raw)
In-Reply-To: <20160228140739.GA7577@spo001.leaseweb.nl>

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


  parent reply	other threads:[~2016-02-28 15:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 19:09 [PATCH v3] watchdog: Add watchdog timer support for the WinSystems EBC-C384 William Breathitt Gray
2016-01-25 19:28 ` One Thousand Gnomes
2016-01-25 20:42   ` Guenter Roeck
2016-01-25 23:36     ` William Breathitt Gray
2016-01-26  1:26       ` Guenter Roeck
2016-01-26 23:38         ` William Breathitt Gray
2016-01-27  5:02           ` Guenter Roeck
2016-01-28  0:18             ` William Breathitt Gray
2016-01-28  1:51               ` Guenter Roeck
2016-01-28 11:05               ` One Thousand Gnomes
2016-01-28 11:05                 ` One Thousand Gnomes
2016-01-26  1:58       ` Guenter Roeck
2016-02-28 14:07   ` Wim Van Sebroeck
2016-02-28 14:36     ` William Breathitt Gray
2016-02-28 15:02     ` Guenter Roeck [this message]
2016-02-28 16:24       ` Wim Van Sebroeck
2016-01-26  1:11 ` Guenter Roeck
2016-01-26  9:09 ` Paul Bolle
2016-01-26 12:33   ` William Breathitt Gray
  -- strict thread matches above, loose matches on Subject: below --
2016-01-26 14:31 William Breathitt Gray
2016-01-26 15:30 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D30BFE.7060805@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=vilhelm.gray@gmail.com \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.