]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
watchdog: hpwdt: Add support for WDIOC_SETOPTIONS
authorJean Delvare <jdelvare@suse.de>
Sun, 21 Jun 2015 07:32:33 +0000 (09:32 +0200)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 27 Feb 2017 19:26:07 +0000 (11:26 -0800)
Orabug: 25505543

WDIOC_SETOPTIONS makes it possible to disable and re-enable the
watchdog timer while the hpwdt driver is loaded.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
(cherry picked from commit 46c80b20d07e9309677d81e1226dc30a055b63b7)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
drivers/watchdog/hpwdt.c

index ada3e44f99328424d11994ec03ebdd4886f4a919..286369d4f0f50928c4b837eb362a8e0fb5c6fa02 100644 (file)
@@ -588,7 +588,7 @@ static long hpwdt_ioctl(struct file *file, unsigned int cmd,
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
-       int new_margin;
+       int new_margin, options;
        int ret = -ENOTTY;
 
        switch (cmd) {
@@ -608,6 +608,20 @@ static long hpwdt_ioctl(struct file *file, unsigned int cmd,
                ret = 0;
                break;
 
+       case WDIOC_SETOPTIONS:
+               ret = get_user(options, p);
+               if (ret)
+                       break;
+
+               if (options & WDIOS_DISABLECARD)
+                       hpwdt_stop();
+
+               if (options & WDIOS_ENABLECARD) {
+                       hpwdt_start();
+                       hpwdt_ping();
+               }
+               break;
+
        case WDIOC_SETTIMEOUT:
                ret = get_user(new_margin, p);
                if (ret)