Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / drivers / char / watchdog / alim1535_wdt.c
index 9a3207d..8338ca3 100644 (file)
@@ -38,12 +38,7 @@ static int timeout = WATCHDOG_TIMEOUT;
 module_param(timeout, int, 0);
 MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (0<timeout<18000, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
-#ifdef CONFIG_WATCHDOG_NOWAYOUT
-static int nowayout = 1;
-#else
-static int nowayout = 0;
-#endif
-
+static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
 
@@ -138,13 +133,9 @@ static int ali_settimer(int t)
  *     the next close to turn off the watchdog.
  */
 
-static ssize_t ali_write(struct file *file, const char *data,
+static ssize_t ali_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;
-
        /* See if we got the magic character 'V' and reload the timer */
        if (len) {
                if (!nowayout) {
@@ -184,6 +175,8 @@ static ssize_t ali_write(struct file *file, const char *data,
 static int ali_ioctl(struct inode *inode, struct file *file,
                          unsigned int cmd, unsigned long arg)
 {
+       void __user *argp = (void __user *)arg;
+       int __user *p = argp;
        static struct watchdog_info ident = {
                .options =              WDIOF_KEEPALIVEPING |
                                        WDIOF_SETTIMEOUT |
@@ -194,12 +187,12 @@ static int ali_ioctl(struct inode *inode, struct file *file,
 
        switch (cmd) {
                case WDIOC_GETSUPPORT:
-                       return copy_to_user((struct watchdog_info *) arg, &ident,
+                       return copy_to_user(argp, &ident,
                                sizeof (ident)) ? -EFAULT : 0;
 
                case WDIOC_GETSTATUS:
                case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, (int *) arg);
+                       return put_user(0, p);
 
                case WDIOC_KEEPALIVE:
                        ali_keepalive();
@@ -209,7 +202,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
                {
                        int new_options, retval = -EINVAL;
 
-                       if (get_user (new_options, (int *) arg))
+                       if (get_user (new_options, p))
                                return -EFAULT;
 
                        if (new_options & WDIOS_DISABLECARD) {
@@ -229,7 +222,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
                {
                        int new_timeout;
 
-                       if (get_user(new_timeout, (int *) arg))
+                       if (get_user(new_timeout, p))
                                return -EFAULT;
 
                        if (ali_settimer(new_timeout))
@@ -240,7 +233,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
                }
 
                case WDIOC_GETTIMEOUT:
-                       return put_user(timeout, (int *)arg);
+                       return put_user(timeout, p);
 
                default:
                        return -ENOIOCTLCMD;
@@ -264,7 +257,7 @@ static int ali_open(struct inode *inode, struct file *file)
 
        /* Activate */
        ali_start();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 /*
@@ -319,7 +312,7 @@ static int ali_notify_sys(struct notifier_block *this, unsigned long code, void
  */
 
 static struct pci_device_id ali_pci_tbl[] = {
-       { PCI_VENDOR_ID_AL, 1535, PCI_ANY_ID, PCI_ANY_ID,},
+       { PCI_VENDOR_ID_AL, 0x1535, PCI_ANY_ID, PCI_ANY_ID,},
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, ali_pci_tbl);