[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5571A0B5.5030205@roeck-us.net>
Date: Fri, 05 Jun 2015 06:14:29 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Markus Rinne <markus.rinne@...cit.fi>, wim@...ana.be
CC: linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] watchdog: imx2_wdt: Fix ioctl() results
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@...cit.fi>
> ---
Good catch.
Reviewed-by: Guenter Roeck <linux@...ck-us.net>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists