patch-2.1.27 linux/drivers/isdn/pcbit/drv.c

Next file: linux/drivers/isdn/pcbit/layer2.c
Previous file: linux/drivers/isdn/pcbit/capi.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.26/linux/drivers/isdn/pcbit/drv.c linux/drivers/isdn/pcbit/drv.c
@@ -37,7 +37,6 @@
 #include <linux/isdnif.h>
 #include <asm/string.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
 
 #include "pcbit.h"
 #include "edss1.h"
@@ -227,7 +226,6 @@
 	struct pcbit_dev  *dev;
 	struct pcbit_chan *chan;
 	struct callb_data info;
-	char *cp;
 
 	dev = finddev(ctl->driver);
 
@@ -246,14 +244,7 @@
 		break;
 	case ISDN_CMD_DIAL:
 		info.type = EV_USR_SETUP_REQ;
-		info.data.setup.CalledPN = (char *) &ctl->num;
-		cp = strchr(info.data.setup.CalledPN, ',');
-		if (cp)
-			*cp = 0;
-		else {
-			printk(KERN_DEBUG "DIAL: error in CalledPN\n");
-			return -1;
-		}		
+		info.data.setup.CalledPN = (char *) &ctl->parm.setup.phone;
 		pcbit_fsm_event(dev, chan, EV_USR_SETUP_REQ, &info);
 		break;
 	case ISDN_CMD_ACCEPTD:
@@ -281,7 +272,7 @@
 		pcbit_clear_msn(dev);
 		break;
 	case ISDN_CMD_SETEAZ:
-		pcbit_set_msn(dev, ctl->num);
+		pcbit_set_msn(dev, ctl->parm.num);
 		break;
 	case ISDN_CMD_SETL3:
 		if ((ctl->arg >> 8) != ISDN_PROTO_L3_TRANS)
@@ -429,8 +420,7 @@
 		{
 			u_char cbuf[1024];
 
-			if (copy_from_user(cbuf, buf, len))
-				return -EFAULT;
+			copy_from_user(cbuf, buf, len);
 			for (i=0; i<len; i++)
 				writeb(cbuf[i], dev->sh_mem + i);
 		}
@@ -448,11 +438,7 @@
 			/* get it into kernel space */
 			if ((ptr = kmalloc(len, GFP_KERNEL))==NULL)
 				return -ENOMEM;
-			if (copy_from_user(ptr, buf, len))
-			{
-				kfree(ptr);
-				return -EFAULT;
-			}
+			copy_from_user(ptr, buf, len);
 			loadbuf = ptr;
 		}
 		else
@@ -751,7 +737,7 @@
 #endif
 	}
 
-	skb->free = 1;
+	SET_SKB_FREE(skb);
 
 	kfree_skb(skb, FREE_READ);
 
@@ -767,12 +753,12 @@
 static int stat_end = 0;
 
 
-extern inline int memcpy_to_COND(int flag, void *d, void *s, int len)
-{
+static __inline void
+memcpy_to_COND(int flag, char *d, const char *s, int len) {
 	if (flag)
-		return copy_to_user(d, s, len);
-	memcpy(d, s, len);
-	return 0;
+		copy_to_user(d, s, len);
+	else
+		memcpy(d, s, len);
 }
 
 
@@ -790,27 +776,24 @@
 
 	if (stat_st < stat_end)
 	{
-		if (memcpy_to_COND(user, buf, statbuf + stat_st, len))
-			return -EFAULT;
+		memcpy_to_COND(user, buf, statbuf + stat_st, len);
 		stat_st += len;	   
 	}
 	else
 	{
 		if (len > STATBUF_LEN - stat_st)
 		{
-			if (memcpy_to_COND(user, buf, statbuf + stat_st, 
-				       STATBUF_LEN - stat_st))
-			       	return -EFAULT;
-			if (memcpy_to_COND(user, buf, statbuf, 
-				       len - (STATBUF_LEN - stat_st)))
-				return -EFAULT;
+			memcpy_to_COND(user, buf, statbuf + stat_st, 
+				       STATBUF_LEN - stat_st);
+			memcpy_to_COND(user, buf, statbuf, 
+				       len - (STATBUF_LEN - stat_st));
+
 			stat_st = len - (STATBUF_LEN - stat_st);
 		}
 		else
 		{
-			if (memcpy_to_COND(user, buf, statbuf + stat_st,
-				       len))
-			       return -EFAULT;
+			memcpy_to_COND(user, buf, statbuf + stat_st, 
+				       len);
 
 			stat_st += len;
 			
@@ -953,7 +936,7 @@
 		return -ENODEV;
 	}
 
-	cmd = (struct pcbit_ioctl *) ctl->num;
+	cmd = (struct pcbit_ioctl *) ctl->parm.num;
 
 	switch(ctl->arg) {
 	case PCBIT_IOCTL_GETSTAT:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov