Merge branch 'for-2.6.37' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/asoc...
[firefly-linux-kernel-4.4.55.git] / drivers / char / n_hdlc.c
index 1c43c8cdee259f18d3ffbf0e063be81dc5c2f3f2..47d32281032c75322b1181c65ab710f00b7967c6 100644 (file)
@@ -97,6 +97,7 @@
 #include <linux/slab.h>
 #include <linux/tty.h>
 #include <linux/errno.h>
+#include <linux/smp_lock.h>
 #include <linux/string.h>      /* used in new tty drivers */
 #include <linux/signal.h>      /* used in new tty drivers */
 #include <linux/if.h>
@@ -597,18 +598,18 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
                return -EFAULT;
        }
 
-       lock_kernel();
+       tty_lock();
 
        for (;;) {
                if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) {
-                       unlock_kernel();
+                       tty_unlock();
                        return -EIO;
                }
 
                n_hdlc = tty2n_hdlc (tty);
                if (!n_hdlc || n_hdlc->magic != HDLC_MAGIC ||
                         tty != n_hdlc->tty) {
-                       unlock_kernel();
+                       tty_unlock();
                        return 0;
                }
 
@@ -618,13 +619,13 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
                        
                /* no data */
                if (file->f_flags & O_NONBLOCK) {
-                       unlock_kernel();
+                       tty_unlock();
                        return -EAGAIN;
                }
                        
                interruptible_sleep_on (&tty->read_wait);
                if (signal_pending(current)) {
-                       unlock_kernel();
+                       tty_unlock();
                        return -EINTR;
                }
        }
@@ -647,7 +648,7 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
                kfree(rbuf);
        else    
                n_hdlc_buf_put(&n_hdlc->rx_free_buf_list,rbuf);
-       unlock_kernel();
+       tty_unlock();
        return ret;
        
 }      /* end of n_hdlc_tty_read() */
@@ -690,7 +691,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
                count = maxframe;
        }
        
-       lock_kernel();
+       tty_lock();
 
        add_wait_queue(&tty->write_wait, &wait);
        set_current_state(TASK_INTERRUPTIBLE);
@@ -730,7 +731,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
                n_hdlc_buf_put(&n_hdlc->tx_buf_list,tbuf);
                n_hdlc_send_frames(n_hdlc,tty);
        }
-       unlock_kernel();
+       tty_unlock();
        return error;
        
 }      /* end of n_hdlc_tty_write() */