Lines Matching refs:tty
146 struct tty_struct *tty; member
178 static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
180 static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
182 static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
184 static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp,
186 static int n_hdlc_tty_open(struct tty_struct *tty);
187 static void n_hdlc_tty_close(struct tty_struct *tty);
188 static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *cp,
190 static void n_hdlc_tty_wakeup(struct tty_struct *tty);
194 #define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data)) argument
195 #define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty)
197 static void flush_rx_queue(struct tty_struct *tty) in flush_rx_queue() argument
199 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in flush_rx_queue()
206 static void flush_tx_queue(struct tty_struct *tty) in flush_tx_queue() argument
208 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in flush_tx_queue()
236 struct tty_struct *tty = n_hdlc2tty (n_hdlc); in n_hdlc_release() local
243 wake_up_interruptible (&tty->read_wait); in n_hdlc_release()
244 wake_up_interruptible (&tty->write_wait); in n_hdlc_release()
246 if (tty->disc_data == n_hdlc) in n_hdlc_release()
247 tty->disc_data = NULL; /* Break the tty->n_hdlc link */ in n_hdlc_release()
289 static void n_hdlc_tty_close(struct tty_struct *tty) in n_hdlc_tty_close() argument
291 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_close()
302 clear_bit(TTY_NO_WRITE_SPLIT,&tty->flags); in n_hdlc_tty_close()
304 tty->disc_data = NULL; in n_hdlc_tty_close()
305 if (tty == n_hdlc->backup_tty) in n_hdlc_tty_close()
307 if (tty != n_hdlc->tty) in n_hdlc_tty_close()
310 n_hdlc->tty = n_hdlc->backup_tty; in n_hdlc_tty_close()
327 static int n_hdlc_tty_open (struct tty_struct *tty) in n_hdlc_tty_open() argument
329 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_open()
334 tty->name); in n_hdlc_tty_open()
348 tty->disc_data = n_hdlc; in n_hdlc_tty_open()
349 n_hdlc->tty = tty; in n_hdlc_tty_open()
350 tty->receive_room = 65536; in n_hdlc_tty_open()
354 set_bit(TTY_NO_WRITE_SPLIT,&tty->flags); in n_hdlc_tty_open()
358 tty_driver_flush_buffer(tty); in n_hdlc_tty_open()
376 static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) in n_hdlc_send_frames() argument
403 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_send_frames()
404 actual = tty->ops->write(tty, tbuf->buf, tbuf->count); in n_hdlc_send_frames()
425 wake_up_interruptible(&tty->write_wait); in n_hdlc_send_frames()
444 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_send_frames()
465 static void n_hdlc_tty_wakeup(struct tty_struct *tty) in n_hdlc_tty_wakeup() argument
467 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in n_hdlc_tty_wakeup()
475 if (tty != n_hdlc->tty) { in n_hdlc_tty_wakeup()
476 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_tty_wakeup()
480 n_hdlc_send_frames (n_hdlc, tty); in n_hdlc_tty_wakeup()
494 static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, in n_hdlc_tty_receive() argument
497 register struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_receive()
505 if (!n_hdlc || tty != n_hdlc->tty) in n_hdlc_tty_receive()
546 wake_up_interruptible (&tty->read_wait); in n_hdlc_tty_receive()
547 if (n_hdlc->tty->fasync != NULL) in n_hdlc_tty_receive()
548 kill_fasync (&n_hdlc->tty->fasync, SIGIO, POLL_IN); in n_hdlc_tty_receive()
561 static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, in n_hdlc_tty_read() argument
564 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in n_hdlc_tty_read()
583 add_wait_queue(&tty->read_wait, &wait); in n_hdlc_tty_read()
586 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { 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()
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 unsigned int 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()