]> err.no Git - linux-2.6/blobdiff - drivers/watchdog/pcwd_usb.c
[WATCHDOG] sbc8360.c - move stop code into a function
[linux-2.6] / drivers / watchdog / pcwd_usb.c
index bf443d077a1ea40b9b907b27055f50e7fd56a464..8c582bc0588ebc2f62f4ac63270c2b7cbf19603e 100644 (file)
@@ -40,8 +40,7 @@
 #include <linux/slab.h>                /* For kmalloc, ... */
 #include <linux/mutex.h>       /* For mutex locking */
 #include <linux/hid.h>         /* For HID_REQ_SET_REPORT & HID_DT_REPORT */
-
-#include <asm/uaccess.h>       /* For copy_to_user/put_user/... */
+#include <linux/uaccess.h>     /* For copy_to_user/put_user/... */
 
 
 #ifdef CONFIG_USB_DEBUG
@@ -369,8 +368,8 @@ static ssize_t usb_pcwd_write(struct file *file, const char __user *data,
        return len;
 }
 
-static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
-                         unsigned int cmd, unsigned long arg)
+static long usb_pcwd_ioctl(struct file *file, unsigned int cmd,
+                                               unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -383,77 +382,77 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
        };
 
        switch (cmd) {
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident,
-                               sizeof (ident)) ? -EFAULT : 0;
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident,
+                       sizeof (ident)) ? -EFAULT : 0;
 
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
 
-               case WDIOC_GETTEMP:
-               {
-                       int temperature;
+       case WDIOC_GETTEMP:
+       {
+               int temperature;
 
-                       if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
-                               return -EFAULT;
+               if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
+                       return -EFAULT;
 
-                       return put_user(temperature, p);
-               }
+               return put_user(temperature, p);
+       }
 
-               case WDIOC_KEEPALIVE:
-                       usb_pcwd_keepalive(usb_pcwd_device);
-                       return 0;
+       case WDIOC_SETOPTIONS:
+       {
+               int new_options, retval = -EINVAL;
 
-               case WDIOC_SETOPTIONS:
-               {
-                       int new_options, retval = -EINVAL;
+               if (get_user (new_options, p))
+                       return -EFAULT;
 
-                       if (get_user (new_options, p))
-                               return -EFAULT;
+               if (new_options & WDIOS_DISABLECARD) {
+                       usb_pcwd_stop(usb_pcwd_device);
+                       retval = 0;
+               }
 
-                       if (new_options & WDIOS_DISABLECARD) {
-                               usb_pcwd_stop(usb_pcwd_device);
-                               retval = 0;
-                       }
+               if (new_options & WDIOS_ENABLECARD) {
+                       usb_pcwd_start(usb_pcwd_device);
+                       retval = 0;
+               }
 
-                       if (new_options & WDIOS_ENABLECARD) {
-                               usb_pcwd_start(usb_pcwd_device);
-                               retval = 0;
-                       }
+               return retval;
+       }
 
-                       return retval;
-               }
+       case WDIOC_KEEPALIVE:
+               usb_pcwd_keepalive(usb_pcwd_device);
+               return 0;
 
-               case WDIOC_SETTIMEOUT:
-               {
-                       int new_heartbeat;
+       case WDIOC_SETTIMEOUT:
+       {
+               int new_heartbeat;
 
-                       if (get_user(new_heartbeat, p))
-                               return -EFAULT;
+               if (get_user(new_heartbeat, p))
+                       return -EFAULT;
 
-                       if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat))
-                           return -EINVAL;
+               if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat))
+                   return -EINVAL;
 
-                       usb_pcwd_keepalive(usb_pcwd_device);
-                       /* Fall */
-               }
+               usb_pcwd_keepalive(usb_pcwd_device);
+               /* Fall */
+       }
 
-               case WDIOC_GETTIMEOUT:
-                       return put_user(heartbeat, p);
+       case WDIOC_GETTIMEOUT:
+               return put_user(heartbeat, p);
 
-               case WDIOC_GETTIMELEFT:
-               {
-                       int time_left;
+       case WDIOC_GETTIMELEFT:
+       {
+               int time_left;
 
-                       if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left))
-                               return -EFAULT;
+               if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left))
+                       return -EFAULT;
 
-                       return put_user(time_left, p);
-               }
+               return put_user(time_left, p);
+       }
 
-               default:
-                       return -ENOTTY;
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -535,7 +534,7 @@ static const struct file_operations usb_pcwd_fops = {
        .owner =        THIS_MODULE,
        .llseek =       no_llseek,
        .write =        usb_pcwd_write,
-       .ioctl =        usb_pcwd_ioctl,
+       .unlocked_ioctl = usb_pcwd_ioctl,
        .open =         usb_pcwd_open,
        .release =      usb_pcwd_release,
 };