[WATCHDOG] mv64x60_wdt: Add WDIOC_SETOPTIONS ioctl support
authorDale Farnsworth <dale@farnsworth.org>
Tue, 24 Jul 2007 18:16:29 +0000 (11:16 -0700)
committerWim Van Sebroeck <wim@iguana.be>
Tue, 24 Jul 2007 21:16:15 +0000 (21:16 +0000)
Allow the watchdog timer to be enabled or disabled via the
WDIOC_SETOPTIONS ioctl.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
drivers/char/watchdog/mv64x60_wdt.c

index e990e3af8be43f866fe44740fe825ade0fc206c8..7b4812776382e0c0bf7dae0aeb976402509f3462 100644 (file)
@@ -132,6 +132,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
                             unsigned int cmd, unsigned long arg)
 {
        int timeout;
+       int options;
        void __user *argp = (void __user *)arg;
        static struct watchdog_info info = {
                .options =      WDIOF_SETTIMEOUT        |
@@ -157,7 +158,15 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
                return -EOPNOTSUPP;
 
        case WDIOC_SETOPTIONS:
-               return -EOPNOTSUPP;
+               if (get_user(options, (int __user *)argp))
+                       return -EFAULT;
+
+               if (options & WDIOS_DISABLECARD)
+                       mv64x60_wdt_handler_disable();
+
+               if (options & WDIOS_ENABLECARD)
+                       mv64x60_wdt_handler_enable();
+               break;
 
        case WDIOC_KEEPALIVE:
                mv64x60_wdt_service();