diff options
author | Wim Van Sebroeck <wim@iguana.be> | 2011-07-22 14:58:21 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2011-07-28 04:01:11 -0400 |
commit | 014d694e5d59e4219803cd14deaae496d86e4910 (patch) | |
tree | c79d00c812b6f01fc477318cbcc003e2826f9f24 /drivers | |
parent | 234445b4e4542f3e0f216459245ab369a18adcf2 (diff) |
watchdog: WatchDog Timer Driver Core - Add WDIOC_SETTIMEOUT and WDIOC_GETTIMEOUT ioctl
This part add's the WDIOC_SETTIMEOUT and WDIOC_GETTIMEOUT ioctl
functionality to the WatchDog Timer Driver Core framework.
Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/watchdog/watchdog_dev.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 9f5550e16ab5..2c0289deaadd 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c | |||
@@ -190,6 +190,26 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, | |||
190 | return -EOPNOTSUPP; | 190 | return -EOPNOTSUPP; |
191 | watchdog_ping(wdd); | 191 | watchdog_ping(wdd); |
192 | return 0; | 192 | return 0; |
193 | case WDIOC_SETTIMEOUT: | ||
194 | if ((wdd->ops->set_timeout == NULL) || | ||
195 | !(wdd->info->options & WDIOF_SETTIMEOUT)) | ||
196 | return -EOPNOTSUPP; | ||
197 | if (get_user(val, p)) | ||
198 | return -EFAULT; | ||
199 | err = wdd->ops->set_timeout(wdd, val); | ||
200 | if (err < 0) | ||
201 | return err; | ||
202 | wdd->timeout = val; | ||
203 | /* If the watchdog is active then we send a keepalive ping | ||
204 | * to make sure that the watchdog keep's running (and if | ||
205 | * possible that it takes the new timeout) */ | ||
206 | watchdog_ping(wdd); | ||
207 | /* Fall */ | ||
208 | case WDIOC_GETTIMEOUT: | ||
209 | /* timeout == 0 means that we don't know the timeout */ | ||
210 | if (wdd->timeout == 0) | ||
211 | return -EOPNOTSUPP; | ||
212 | return put_user(wdd->timeout, p); | ||
193 | default: | 213 | default: |
194 | return -ENOTTY; | 214 | return -ENOTTY; |
195 | } | 215 | } |