diff options
Diffstat (limited to 'drivers/watchdog')
-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 | } |