Lines Matching refs:tty
148 struct tty_struct *tty; member
180 static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
182 static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
184 static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
186 static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp,
188 static int n_hdlc_tty_open(struct tty_struct *tty);
189 static void n_hdlc_tty_close(struct tty_struct *tty);
190 static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *cp,
192 static void n_hdlc_tty_wakeup(struct tty_struct *tty);
196 #define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data)) argument
197 #define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty)
199 static void flush_rx_queue(struct tty_struct *tty) in flush_rx_queue() argument
201 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in flush_rx_queue()
208 static void flush_tx_queue(struct tty_struct *tty) in flush_tx_queue() argument
210 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in flush_tx_queue()
245 struct tty_struct *tty = n_hdlc2tty (n_hdlc); in n_hdlc_release() local
252 wake_up_interruptible (&tty->read_wait); in n_hdlc_release()
253 wake_up_interruptible (&tty->write_wait); in n_hdlc_release()
255 if (tty->disc_data == n_hdlc) in n_hdlc_release()
256 tty->disc_data = NULL; /* Break the tty->n_hdlc link */ in n_hdlc_release()
299 static void n_hdlc_tty_close(struct tty_struct *tty) in n_hdlc_tty_close() argument
301 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_close()
312 clear_bit(TTY_NO_WRITE_SPLIT,&tty->flags); in n_hdlc_tty_close()
314 tty->disc_data = NULL; in n_hdlc_tty_close()
315 if (tty == n_hdlc->backup_tty) in n_hdlc_tty_close()
317 if (tty != n_hdlc->tty) in n_hdlc_tty_close()
320 n_hdlc->tty = n_hdlc->backup_tty; in n_hdlc_tty_close()
337 static int n_hdlc_tty_open (struct tty_struct *tty) in n_hdlc_tty_open() argument
339 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_open()
344 tty->name); in n_hdlc_tty_open()
358 tty->disc_data = n_hdlc; in n_hdlc_tty_open()
359 n_hdlc->tty = tty; in n_hdlc_tty_open()
360 tty->receive_room = 65536; in n_hdlc_tty_open()
364 set_bit(TTY_NO_WRITE_SPLIT,&tty->flags); in n_hdlc_tty_open()
368 tty_driver_flush_buffer(tty); in n_hdlc_tty_open()
386 static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) in n_hdlc_send_frames() argument
419 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_send_frames()
420 actual = tty->ops->write(tty, tbuf->buf, tbuf->count); in n_hdlc_send_frames()
444 wake_up_interruptible(&tty->write_wait); in n_hdlc_send_frames()
461 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_send_frames()
482 static void n_hdlc_tty_wakeup(struct tty_struct *tty) in n_hdlc_tty_wakeup() argument
484 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in n_hdlc_tty_wakeup()
492 if (tty != n_hdlc->tty) { in n_hdlc_tty_wakeup()
493 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_tty_wakeup()
497 n_hdlc_send_frames (n_hdlc, tty); in n_hdlc_tty_wakeup()
511 static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, in n_hdlc_tty_receive() argument
514 register struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_receive()
522 if (!n_hdlc || tty != n_hdlc->tty) in n_hdlc_tty_receive()
563 wake_up_interruptible (&tty->read_wait); in n_hdlc_tty_receive()
564 if (n_hdlc->tty->fasync != NULL) in n_hdlc_tty_receive()
565 kill_fasync (&n_hdlc->tty->fasync, SIGIO, POLL_IN); in n_hdlc_tty_receive()
578 static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, in n_hdlc_tty_read() argument
581 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in n_hdlc_tty_read()
600 add_wait_queue(&tty->read_wait, &wait); in n_hdlc_tty_read()
603 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { in n_hdlc_tty_read()
646 remove_wait_queue(&tty->read_wait, &wait); in n_hdlc_tty_read()
662 static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, in n_hdlc_tty_write() argument
665 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_write()
691 add_wait_queue(&tty->write_wait, &wait); in n_hdlc_tty_write()
706 n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_write()
708 tty != n_hdlc->tty) { in n_hdlc_tty_write()
721 remove_wait_queue(&tty->write_wait, &wait); in n_hdlc_tty_write()
730 n_hdlc_send_frames(n_hdlc,tty); in n_hdlc_tty_write()
746 static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file, in n_hdlc_tty_ioctl() argument
749 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_ioctl()
777 count = tty_chars_in_buffer(tty); in n_hdlc_tty_ioctl()
790 flush_tx_queue(tty); in n_hdlc_tty_ioctl()
795 error = n_tty_ioctl_helper(tty, file, cmd, arg); in n_hdlc_tty_ioctl()
812 static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, in n_hdlc_tty_poll() argument
815 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_poll()
821 if (n_hdlc && n_hdlc->magic == HDLC_MAGIC && tty == n_hdlc->tty) { in n_hdlc_tty_poll()
825 poll_wait(filp, &tty->read_wait, wait); in n_hdlc_tty_poll()
826 poll_wait(filp, &tty->write_wait, wait); in n_hdlc_tty_poll()
831 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) in n_hdlc_tty_poll()
835 if (!tty_is_writelocked(tty) && in n_hdlc_tty_poll()