All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Markus Rinne <markus.rinne@vincit.fi>, wim@iguana.be
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: imx2_wdt: Fix ioctl() results
Date: Fri, 05 Jun 2015 06:14:29 -0700	[thread overview]
Message-ID: <5571A0B5.5030205@roeck-us.net> (raw)
In-Reply-To: <20150605124144.GA26755@markusri_laptop.vincit.intranet>

On 06/05/2015 05:41 AM, Markus Rinne wrote:
> WDIOC_SETTIMEOUT and WDIOC_GETTIMEOUT returned the initial timeout and
> not the one that was last set.  Fix this by updating struct
> watchdog_device member 'timeout'.  This is how it's supposed to be done
> according to Documentation/watchdog/watchdog-kernel-api.txt.
>
> This is the test case I used:
>
> #include <fcntl.h>
> #include <linux/watchdog.h>
> #include <sys/stat.h>
> #include <sys/types.h>
>
> #include <assert.h>
> #include <stdlib.h>
>
> static const int TIMEOUT = 127;
>
> int main(void)
> {
> 	int fd = open("/dev/watchdog", O_WRONLY);
> 	if (fd == -1)
> 		return EXIT_FAILURE;
>
> 	int timeout = TIMEOUT;
> 	ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
> 	assert(timeout == TIMEOUT);
>
> 	close(fd);
>
> 	return EXIT_SUCCESS;
> }
>
> Signed-off-by: Markus Rinne <markus.rinne@vincit.fi>
> ---

Good catch.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>


  reply	other threads:[~2015-06-05 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05 12:41 [PATCH] watchdog: imx2_wdt: Fix ioctl() results Markus Rinne
2015-06-05 13:14 ` Guenter Roeck [this message]
2015-06-05 14:14 ` Vladimir Zapolskiy
2015-06-05 14:38   ` 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=5571A0B5.5030205@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=markus.rinne@vincit.fi \
    --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.