[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51A75F11.7000001@monstr.eu>
Date: Thu, 30 May 2013 16:15:45 +0200
From: Michal Simek <monstr@...str.eu>
To: Guenter Roeck <linux@...ck-us.net>
CC: Michal Simek <michal.simek@...inx.com>,
linux-kernel@...r.kernel.org, Wim Van Sebroeck <wim@...ana.be>,
linux-watchdog@...r.kernel.org
Subject: Re: [PATCH 3/3] watchdog: xilinx: Add WDIOC_SETTIMEOUT ioctl function
On 05/30/2013 04:07 PM, Guenter Roeck wrote:
> On Thu, May 30, 2013 at 02:26:04PM +0200, Michal Simek wrote:
>> Standard watchdog programs try to setup timeout
>> via ioctl and this functionality should be implemented.
>> Timeout value is hardcoded in the hardware but
>> based on Documentation/watchdog/watchdog-api.txt
>> can return the real timeout used in the same variable.
>>
>> Signed-off-by: Michal Simek <michal.simek@...inx.com>
>> ---
>> drivers/watchdog/of_xilinx_wdt.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
>> index 79f358c..a3bbe72 100644
>> --- a/drivers/watchdog/of_xilinx_wdt.c
>> +++ b/drivers/watchdog/of_xilinx_wdt.c
>> @@ -253,6 +253,7 @@ static long xwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>> xwdt_keepalive();
>> return 0;
>>
>> + case WDIOC_SETTIMEOUT:
>> case WDIOC_GETTIMEOUT:
>> if (no_timeout)
>> return -ENOTTY;
>
> Watchdog programs should check ident.options before trying to set the timeout.
> If they don't, there is an application bug. I don't think it is a good idea
> to start hacking the kernel to work around application bugs.
Based on Documentation/watchdog/watchdog-api.txt
"For some drivers it is possible to modify the watchdog timeout on the
fly with the SETTIMEOUT ioctl, those drivers have the WDIOF_SETTIMEOUT
flag set in their option field. The argument is an integer
representing the timeout in seconds. The driver returns the real
timeout used in the same variable, and this timeout might differ from
the requested one due to limitation of the hardware.
int timeout = 45;
ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
printf("The timeout was set to %d seconds\n", timeout);
This example might actually print "The timeout was set to 60 seconds"
if the device has a granularity of minutes for its timeout."
should be completely fine that user application is trying to setup timeout
and driver should return value based on it.
And yes, user application should check return value from ioctl call
but still based on documentation driver can properly support it too.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
Download attachment "signature.asc" of type "application/pgp-signature" (264 bytes)
Powered by blists - more mailing lists