tty: replace BKL with a new tty_lock
As a preparation for replacing the big kernel lock in the TTY layer, wrap all the callers in new macros tty_lock, tty_lock_nested and tty_unlock. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
3f582b8c11
commit
ec79d6056d
@@ -598,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;
|
||||
}
|
||||
|
||||
@@ -619,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;
|
||||
}
|
||||
}
|
||||
@@ -648,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() */
|
||||
@@ -691,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);
|
||||
@@ -731,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() */
|
||||
|
Reference in New Issue
Block a user