Lines Matching refs:tty
160 static void flush_rx_queue(struct tty_struct *tty) in flush_rx_queue() argument
162 struct n_hdlc *n_hdlc = tty->disc_data; in flush_rx_queue()
169 static void flush_tx_queue(struct tty_struct *tty) in flush_tx_queue() argument
171 struct n_hdlc *n_hdlc = tty->disc_data; in flush_tx_queue()
195 static void n_hdlc_tty_close(struct tty_struct *tty) in n_hdlc_tty_close() argument
197 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_close()
204 clear_bit(TTY_NO_WRITE_SPLIT, &tty->flags); in n_hdlc_tty_close()
206 tty->disc_data = NULL; in n_hdlc_tty_close()
209 wake_up_interruptible(&tty->read_wait); in n_hdlc_tty_close()
210 wake_up_interruptible(&tty->write_wait); in n_hdlc_tty_close()
225 static int n_hdlc_tty_open(struct tty_struct *tty) in n_hdlc_tty_open() argument
227 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_open()
229 pr_debug("%s() called (device=%s)\n", __func__, tty->name); in n_hdlc_tty_open()
243 tty->disc_data = n_hdlc; in n_hdlc_tty_open()
244 tty->receive_room = 65536; in n_hdlc_tty_open()
247 set_bit(TTY_NO_WRITE_SPLIT, &tty->flags); in n_hdlc_tty_open()
250 tty_driver_flush_buffer(tty); in n_hdlc_tty_open()
265 static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) in n_hdlc_send_frames() argument
288 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_send_frames()
289 actual = tty->ops->write(tty, tbuf->buf, tbuf->count); in n_hdlc_send_frames()
308 wake_up_interruptible(&tty->write_wait); in n_hdlc_send_frames()
325 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_send_frames()
342 static void n_hdlc_tty_wakeup(struct tty_struct *tty) in n_hdlc_tty_wakeup() argument
344 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_wakeup()
346 n_hdlc_send_frames(n_hdlc, tty); in n_hdlc_tty_wakeup()
359 static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, in n_hdlc_tty_receive() argument
362 register struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_receive()
403 wake_up_interruptible(&tty->read_wait); in n_hdlc_tty_receive()
404 if (tty->fasync != NULL) in n_hdlc_tty_receive()
405 kill_fasync(&tty->fasync, SIGIO, POLL_IN); in n_hdlc_tty_receive()
418 static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, in n_hdlc_tty_read() argument
421 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_read()
426 add_wait_queue(&tty->read_wait, &wait); in n_hdlc_tty_read()
429 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { in n_hdlc_tty_read()
460 if (tty_io_nonblock(tty, file)) { in n_hdlc_tty_read()
473 remove_wait_queue(&tty->read_wait, &wait); in n_hdlc_tty_read()
489 static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, in n_hdlc_tty_write() argument
492 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_write()
509 add_wait_queue(&tty->write_wait, &wait); in n_hdlc_tty_write()
518 if (tty_io_nonblock(tty, file)) { in n_hdlc_tty_write()
531 remove_wait_queue(&tty->write_wait, &wait); in n_hdlc_tty_write()
540 n_hdlc_send_frames(n_hdlc, tty); in n_hdlc_tty_write()
556 static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file, in n_hdlc_tty_ioctl() argument
559 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_ioctl()
588 count = tty_chars_in_buffer(tty); in n_hdlc_tty_ioctl()
603 flush_tx_queue(tty); in n_hdlc_tty_ioctl()
608 error = n_tty_ioctl_helper(tty, file, cmd, arg); in n_hdlc_tty_ioctl()
625 static __poll_t n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, in n_hdlc_tty_poll() argument
628 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_poll()
638 poll_wait(filp, &tty->read_wait, wait); in n_hdlc_tty_poll()
639 poll_wait(filp, &tty->write_wait, wait); in n_hdlc_tty_poll()
644 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) in n_hdlc_tty_poll()
648 if (!tty_is_writelocked(tty) && in n_hdlc_tty_poll()