* We test the TTY_THROTTLED bit first so that it always
* indicates the current state. The decision about whether
* it is worth allowing more input has been taken by the caller.
- * Can sleep, may be called under the atomic_read_lock mutex but
+ * Can sleep, may be called under the atomic_read semaphore but
* this is not guaranteed.
*/
* buffer, and once to drain the space from the (physical) beginning of
* the buffer to head pointer.
*
- * Called under the tty->atomic_read_lock sem and with TTY_DONT_FLIP set
+ * Called under the tty->atomic_read sem and with TTY_DONT_FLIP set
*
*/
* Internal serialization of reads.
*/
if (file->f_flags & O_NONBLOCK) {
- if (!mutex_trylock(&tty->atomic_read_lock))
+ if (down_trylock(&tty->atomic_read))
return -EAGAIN;
}
else {
- if (mutex_lock_interruptible(&tty->atomic_read_lock))
+ if (down_interruptible(&tty->atomic_read))
return -ERESTARTSYS;
}
* longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode,
* we won't get any more characters.
*/
- if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) {
- n_tty_set_room(tty);
+ if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE)
check_unthrottle(tty);
- }
if (b - buf >= minimum)
break;
timeout = time;
}
clear_bit(TTY_DONT_FLIP, &tty->flags);
- mutex_unlock(&tty->atomic_read_lock);
+ up(&tty->atomic_read);
remove_wait_queue(&tty->read_wait, &wait);
if (!waitqueue_active(&tty->read_wait))