]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/isdn/capi/capi.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6-omap-h63xx.git] / drivers / isdn / capi / capi.c
index 6ca0bb949ad301a0ba109a73b342a1cb7833075f..8a35029caca096d976c064967380037fff2a9cb2 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/signal.h>
 #include <linux/mutex.h>
 #include <linux/mm.h>
+#include <linux/smp_lock.h>
 #include <linux/timer.h>
 #include <linux/wait.h>
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
@@ -465,7 +466,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
        ld = tty_ldisc_ref(mp->tty);
        if (ld == NULL)
                return -1;
-       if (ld->receive_buf == NULL) {
+       if (ld->ops->receive_buf == NULL) {
 #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS)
                printk(KERN_DEBUG "capi: ldisc has no receive_buf function\n");
 #endif
@@ -500,7 +501,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
        printk(KERN_DEBUG "capi: DATA_B3_RESP %u len=%d => ldisc\n",
                                datahandle, skb->len);
 #endif
-       ld->receive_buf(mp->tty, skb->data, NULL, skb->len);
+       ld->ops->receive_buf(mp->tty, skb->data, NULL, skb->len);
        kfree_skb(skb);
        tty_ldisc_deref(ld);
        return 0;
@@ -983,13 +984,17 @@ capi_ioctl(struct inode *inode, struct file *file,
 static int
 capi_open(struct inode *inode, struct file *file)
 {
+       int ret;
+       
+       lock_kernel();
        if (file->private_data)
-               return -EEXIST;
-
-       if ((file->private_data = capidev_alloc()) == NULL)
-               return -ENOMEM;
-
-       return nonseekable_open(inode, file);
+               ret = -EEXIST;
+       else if ((file->private_data = capidev_alloc()) == NULL)
+               ret = -ENOMEM;
+       else
+               ret = nonseekable_open(inode, file);
+       unlock_kernel();
+       return ret;
 }
 
 static int