linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / isdn / isdnloop / isdnloop.c
index fde3db9..33d3397 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/sched.h>
 #include "isdnloop.h"
 
 static char *revision = "$Revision: 1.11.6.7 $";
@@ -443,18 +444,15 @@ isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card * card)
  *   number of bytes actually transferred.
  */
 static int
-isdnloop_readstatus(u_char * buf, int len, int user, isdnloop_card * card)
+isdnloop_readstatus(u_char __user *buf, int len, isdnloop_card * card)
 {
        int count;
-       u_char *p;
+       u_char __user *p;
 
        for (p = buf, count = 0; count < len; p++, count++) {
                if (card->msg_buf_read == card->msg_buf_write)
                        return count;
-               if (user)
-                       put_user(*card->msg_buf_read++, p);
-               else
-                       *p = *card->msg_buf_read++;
+               put_user(*card->msg_buf_read++, p);
                if (card->msg_buf_read > card->msg_buf_end)
                        card->msg_buf_read = card->msg_buf;
        }
@@ -1148,8 +1146,8 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card)
                                case ISDNLOOP_IOCTL_DEBUGVAR:
                                        return (ulong) card;
                                case ISDNLOOP_IOCTL_STARTUP:
-                                       if ((i = verify_area(VERIFY_READ, (void *) a, sizeof(isdnloop_sdef))))
-                                               return i;
+                                       if (!access_ok(VERIFY_READ, (void *) a, sizeof(isdnloop_sdef)))
+                                               return -EFAULT;
                                        return (isdnloop_start(card, (isdnloop_sdef *) a));
                                        break;
                                case ISDNLOOP_IOCTL_ADDCARD:
@@ -1163,10 +1161,9 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card)
                                        if (a) {
                                                if (!card->leased) {
                                                        card->leased = 1;
-                                                       while (card->ptype == ISDN_PTYPE_UNKNOWN) {
-                                                               schedule_timeout(10);
-                                                       }
-                                                       schedule_timeout(10);
+                                                       while (card->ptype == ISDN_PTYPE_UNKNOWN)
+                                                               schedule_timeout_interruptible(10);
+                                                       schedule_timeout_interruptible(10);
                                                        sprintf(cbuf, "00;FV2ON\n01;EAZ1\n02;EAZ2\n");
                                                        i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);
                                                        printk(KERN_INFO
@@ -1388,14 +1385,14 @@ if_command(isdn_ctrl * c)
 }
 
 static int
-if_writecmd(const u_char * buf, int len, int user, int id, int channel)
+if_writecmd(const u_char __user *buf, int len, int id, int channel)
 {
        isdnloop_card *card = isdnloop_findcard(id);
 
        if (card) {
                if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
                        return -ENODEV;
-               return (isdnloop_writecmd(buf, len, user, card));
+               return (isdnloop_writecmd(buf, len, 1, card));
        }
        printk(KERN_ERR
               "isdnloop: if_writecmd called with invalid driverId!\n");
@@ -1403,14 +1400,14 @@ if_writecmd(const u_char * buf, int len, int user, int id, int channel)
 }
 
 static int
-if_readstatus(u_char * buf, int len, int user, int id, int channel)
+if_readstatus(u_char __user *buf, int len, int id, int channel)
 {
        isdnloop_card *card = isdnloop_findcard(id);
 
        if (card) {
                if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
                        return -ENODEV;
-               return (isdnloop_readstatus(buf, len, user, card));
+               return (isdnloop_readstatus(buf, len, card));
        }
        printk(KERN_ERR
               "isdnloop: if_readstatus called with invalid driverId!\n");