diff options
Diffstat (limited to 'drivers/watchdog/watchdog_dev.c')
-rw-r--r-- | drivers/watchdog/watchdog_dev.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 1199da0f98cf..8558da912c42 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c | |||
@@ -226,7 +226,6 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, | |||
226 | err = wdd->ops->set_timeout(wdd, val); | 226 | err = wdd->ops->set_timeout(wdd, val); |
227 | if (err < 0) | 227 | if (err < 0) |
228 | return err; | 228 | return err; |
229 | wdd->timeout = val; | ||
230 | /* If the watchdog is active then we send a keepalive ping | 229 | /* If the watchdog is active then we send a keepalive ping |
231 | * to make sure that the watchdog keep's running (and if | 230 | * to make sure that the watchdog keep's running (and if |
232 | * possible that it takes the new timeout) */ | 231 | * possible that it takes the new timeout) */ |
@@ -237,6 +236,11 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, | |||
237 | if (wdd->timeout == 0) | 236 | if (wdd->timeout == 0) |
238 | return -EOPNOTSUPP; | 237 | return -EOPNOTSUPP; |
239 | return put_user(wdd->timeout, p); | 238 | return put_user(wdd->timeout, p); |
239 | case WDIOC_GETTIMELEFT: | ||
240 | if (!wdd->ops->get_timeleft) | ||
241 | return -EOPNOTSUPP; | ||
242 | |||
243 | return put_user(wdd->ops->get_timeleft(wdd), p); | ||
240 | default: | 244 | default: |
241 | return -ENOTTY; | 245 | return -ENOTTY; |
242 | } | 246 | } |
@@ -347,7 +351,7 @@ int watchdog_dev_register(struct watchdog_device *watchdog) | |||
347 | 351 | ||
348 | /* Only one device can register for /dev/watchdog */ | 352 | /* Only one device can register for /dev/watchdog */ |
349 | if (test_and_set_bit(0, &watchdog_dev_busy)) { | 353 | if (test_and_set_bit(0, &watchdog_dev_busy)) { |
350 | pr_err("only one watchdog can use /dev/watchdog.\n"); | 354 | pr_err("only one watchdog can use /dev/watchdog\n"); |
351 | return -EBUSY; | 355 | return -EBUSY; |
352 | } | 356 | } |
353 | 357 | ||
@@ -355,8 +359,8 @@ int watchdog_dev_register(struct watchdog_device *watchdog) | |||
355 | 359 | ||
356 | err = misc_register(&watchdog_miscdev); | 360 | err = misc_register(&watchdog_miscdev); |
357 | if (err != 0) { | 361 | if (err != 0) { |
358 | pr_err("%s: cannot register miscdev on minor=%d (err=%d).\n", | 362 | pr_err("%s: cannot register miscdev on minor=%d (err=%d)\n", |
359 | watchdog->info->identity, WATCHDOG_MINOR, err); | 363 | watchdog->info->identity, WATCHDOG_MINOR, err); |
360 | goto out; | 364 | goto out; |
361 | } | 365 | } |
362 | 366 | ||
@@ -383,8 +387,8 @@ int watchdog_dev_unregister(struct watchdog_device *watchdog) | |||
383 | 387 | ||
384 | /* We can only unregister the watchdog device that was registered */ | 388 | /* We can only unregister the watchdog device that was registered */ |
385 | if (watchdog != wdd) { | 389 | if (watchdog != wdd) { |
386 | pr_err("%s: watchdog was not registered as /dev/watchdog.\n", | 390 | pr_err("%s: watchdog was not registered as /dev/watchdog\n", |
387 | watchdog->info->identity); | 391 | watchdog->info->identity); |
388 | return -ENODEV; | 392 | return -ENODEV; |
389 | } | 393 | } |
390 | 394 | ||