Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / um / drivers / harddog_kern.c
index 2a4c8cf..d18a974 100644 (file)
@@ -46,7 +46,6 @@
 #include <linux/smp_lock.h>
 #include <linux/init.h>
 #include <asm/uaccess.h>
-#include "helper.h"
 #include "mconsole.h"
 
 MODULE_LICENSE("GPL");
@@ -71,7 +70,7 @@ static int harddog_open(struct inode *inode, struct file *file)
        if(timer_alive)
                return -EBUSY;
 #ifdef CONFIG_HARDDOG_NOWAYOUT  
-       MOD_INC_USE_COUNT;
+       __module_get(THIS_MODULE);
 #endif
 
 #ifdef CONFIG_MCONSOLE
@@ -82,7 +81,7 @@ static int harddog_open(struct inode *inode, struct file *file)
 
        timer_alive = 1;
        unlock_kernel();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 extern void stop_watchdog(int in_fd, int out_fd);
@@ -105,13 +104,9 @@ static int harddog_release(struct inode *inode, struct file *file)
 
 extern int ping_watchdog(int fd);
 
-static ssize_t harddog_write(struct file *file, const char *data, size_t len,
+static ssize_t harddog_write(struct file *file, const char __user *data, size_t len,
                             loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /*
         *      Refresh the timer.
         */
@@ -123,6 +118,7 @@ static ssize_t harddog_write(struct file *file, const char *data, size_t len,
 static int harddog_ioctl(struct inode *inode, struct file *file,
                         unsigned int cmd, unsigned long arg)
 {
+       void __user *argp= (void __user *)arg;
        static struct watchdog_info ident = {
                WDIOC_SETTIMEOUT,
                0,
@@ -132,13 +128,12 @@ static int harddog_ioctl(struct inode *inode, struct file *file,
                default:
                        return -ENOTTY;
                case WDIOC_GETSUPPORT:
-                       if(copy_to_user((struct harddog_info *)arg, &ident,
-                                       sizeof(ident)))
+                       if(copy_to_user(argp, &ident, sizeof(ident)))
                                return -EFAULT;
                        return 0;
                case WDIOC_GETSTATUS:
                case WDIOC_GETBOOTSTATUS:
-                       return put_user(0,(int *)arg);
+                       return put_user(0,(int __user *)argp);
                case WDIOC_KEEPALIVE:
                        return(ping_watchdog(harddog_out_fd));
        }