Lines Matching refs:tty
145 struct tty_struct *tty; member
177 static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
179 static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
181 static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
183 static __poll_t n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp,
185 static int n_hdlc_tty_open(struct tty_struct *tty);
186 static void n_hdlc_tty_close(struct tty_struct *tty);
187 static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *cp,
189 static void n_hdlc_tty_wakeup(struct tty_struct *tty);
193 #define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data)) argument
194 #define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty)
196 static void flush_rx_queue(struct tty_struct *tty) in flush_rx_queue() argument
198 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in flush_rx_queue()
205 static void flush_tx_queue(struct tty_struct *tty) in flush_tx_queue() argument
207 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in flush_tx_queue()
235 struct tty_struct *tty = n_hdlc2tty (n_hdlc); in n_hdlc_release() local
242 wake_up_interruptible (&tty->read_wait); in n_hdlc_release()
243 wake_up_interruptible (&tty->write_wait); in n_hdlc_release()
245 if (tty->disc_data == n_hdlc) in n_hdlc_release()
246 tty->disc_data = NULL; /* Break the tty->n_hdlc link */ in n_hdlc_release()
288 static void n_hdlc_tty_close(struct tty_struct *tty) in n_hdlc_tty_close() argument
290 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_close()
301 clear_bit(TTY_NO_WRITE_SPLIT,&tty->flags); in n_hdlc_tty_close()
303 tty->disc_data = NULL; in n_hdlc_tty_close()
304 if (tty == n_hdlc->backup_tty) in n_hdlc_tty_close()
306 if (tty != n_hdlc->tty) in n_hdlc_tty_close()
309 n_hdlc->tty = n_hdlc->backup_tty; in n_hdlc_tty_close()
326 static int n_hdlc_tty_open (struct tty_struct *tty) in n_hdlc_tty_open() argument
328 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_open()
333 tty->name); in n_hdlc_tty_open()
347 tty->disc_data = n_hdlc; in n_hdlc_tty_open()
348 n_hdlc->tty = tty; in n_hdlc_tty_open()
349 tty->receive_room = 65536; in n_hdlc_tty_open()
353 set_bit(TTY_NO_WRITE_SPLIT,&tty->flags); in n_hdlc_tty_open()
357 tty_driver_flush_buffer(tty); in n_hdlc_tty_open()
375 static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) in n_hdlc_send_frames() argument
402 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_send_frames()
403 actual = tty->ops->write(tty, tbuf->buf, tbuf->count); in n_hdlc_send_frames()
424 wake_up_interruptible(&tty->write_wait); in n_hdlc_send_frames()
443 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_send_frames()
464 static void n_hdlc_tty_wakeup(struct tty_struct *tty) in n_hdlc_tty_wakeup() argument
466 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in n_hdlc_tty_wakeup()
474 if (tty != n_hdlc->tty) { in n_hdlc_tty_wakeup()
475 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_tty_wakeup()
479 n_hdlc_send_frames (n_hdlc, tty); in n_hdlc_tty_wakeup()
493 static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, in n_hdlc_tty_receive() argument
496 register struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_receive()
504 if (!n_hdlc || tty != n_hdlc->tty) in n_hdlc_tty_receive()
545 wake_up_interruptible (&tty->read_wait); in n_hdlc_tty_receive()
546 if (n_hdlc->tty->fasync != NULL) in n_hdlc_tty_receive()
547 kill_fasync (&n_hdlc->tty->fasync, SIGIO, POLL_IN); in n_hdlc_tty_receive()
560 static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, in n_hdlc_tty_read() argument
563 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in n_hdlc_tty_read()
582 add_wait_queue(&tty->read_wait, &wait); in n_hdlc_tty_read()
585 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { in n_hdlc_tty_read()
616 if (tty_io_nonblock(tty, file)) { in n_hdlc_tty_read()
629 remove_wait_queue(&tty->read_wait, &wait); in n_hdlc_tty_read()
645 static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, in n_hdlc_tty_write() argument
648 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_write()
674 add_wait_queue(&tty->write_wait, &wait); in n_hdlc_tty_write()
683 if (tty_io_nonblock(tty, file)) { in n_hdlc_tty_write()
689 n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_write()
691 tty != n_hdlc->tty) { in n_hdlc_tty_write()
704 remove_wait_queue(&tty->write_wait, &wait); in n_hdlc_tty_write()
713 n_hdlc_send_frames(n_hdlc,tty); in n_hdlc_tty_write()
729 static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file, in n_hdlc_tty_ioctl() argument
732 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_ioctl()
763 count = tty_chars_in_buffer(tty); in n_hdlc_tty_ioctl()
778 flush_tx_queue(tty); in n_hdlc_tty_ioctl()
783 error = n_tty_ioctl_helper(tty, file, cmd, arg); in n_hdlc_tty_ioctl()
800 static __poll_t n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, in n_hdlc_tty_poll() argument
803 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_poll()
809 if (n_hdlc && n_hdlc->magic == HDLC_MAGIC && tty == n_hdlc->tty) { in n_hdlc_tty_poll()
813 poll_wait(filp, &tty->read_wait, wait); in n_hdlc_tty_poll()
814 poll_wait(filp, &tty->write_wait, wait); in n_hdlc_tty_poll()
819 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) in n_hdlc_tty_poll()
823 if (!tty_is_writelocked(tty) && in n_hdlc_tty_poll()