]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/watchdog/watchdog_dev.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
[karo-tx-linux.git] / drivers / watchdog / watchdog_dev.c
index 1199da0f98cf2ada1a3a8868c57561f742e723df..8558da912c42fd76c5bde4ddd55528ed0be48615 100644 (file)
@@ -226,7 +226,6 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
                err = wdd->ops->set_timeout(wdd, val);
                if (err < 0)
                        return err;
-               wdd->timeout = val;
                /* If the watchdog is active then we send a keepalive ping
                 * to make sure that the watchdog keep's running (and if
                 * possible that it takes the new timeout) */
@@ -237,6 +236,11 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
                if (wdd->timeout == 0)
                        return -EOPNOTSUPP;
                return put_user(wdd->timeout, p);
+       case WDIOC_GETTIMELEFT:
+               if (!wdd->ops->get_timeleft)
+                       return -EOPNOTSUPP;
+
+               return put_user(wdd->ops->get_timeleft(wdd), p);
        default:
                return -ENOTTY;
        }
@@ -347,7 +351,7 @@ int watchdog_dev_register(struct watchdog_device *watchdog)
 
        /* Only one device can register for /dev/watchdog */
        if (test_and_set_bit(0, &watchdog_dev_busy)) {
-               pr_err("only one watchdog can use /dev/watchdog.\n");
+               pr_err("only one watchdog can use /dev/watchdog\n");
                return -EBUSY;
        }
 
@@ -355,8 +359,8 @@ int watchdog_dev_register(struct watchdog_device *watchdog)
 
        err = misc_register(&watchdog_miscdev);
        if (err != 0) {
-               pr_err("%s: cannot register miscdev on minor=%d (err=%d).\n",
-                       watchdog->info->identity, WATCHDOG_MINOR, err);
+               pr_err("%s: cannot register miscdev on minor=%d (err=%d)\n",
+                      watchdog->info->identity, WATCHDOG_MINOR, err);
                goto out;
        }
 
@@ -383,8 +387,8 @@ int watchdog_dev_unregister(struct watchdog_device *watchdog)
 
        /* We can only unregister the watchdog device that was registered */
        if (watchdog != wdd) {
-               pr_err("%s: watchdog was not registered as /dev/watchdog.\n",
-                       watchdog->info->identity);
+               pr_err("%s: watchdog was not registered as /dev/watchdog\n",
+                      watchdog->info->identity);
                return -ENODEV;
        }