Lines Matching refs:tty
160 struct tty_struct *tty; /* ptr to TTY structure */ member
205 static unsigned int n_hdlc_tty_poll (struct tty_struct *tty, struct file *filp,
209 static int n_hdlc_tty_room (struct tty_struct *tty);
210 static void n_hdlc_tty_receive (struct tty_struct *tty,
212 static void n_hdlc_tty_wakeup (struct tty_struct *tty);
216 #define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data)) argument
217 #define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty)
229 struct tty_struct *tty = n_hdlc2tty (n_hdlc); in n_hdlc_release() local
236 wake_up_interruptible (&tty->read_wait); in n_hdlc_release()
237 wake_up_interruptible (&tty->write_wait); in n_hdlc_release()
239 if (tty != NULL && tty->disc_data == n_hdlc) in n_hdlc_release()
240 tty->disc_data = NULL; /* Break the tty->n_hdlc link */ in n_hdlc_release()
282 static void n_hdlc_tty_close(struct tty_struct *tty) in n_hdlc_tty_close() argument
284 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_close()
295 clear_bit(TTY_NO_WRITE_SPLIT,&tty->flags); in n_hdlc_tty_close()
297 tty->disc_data = NULL; in n_hdlc_tty_close()
298 if (tty == n_hdlc->backup_tty) in n_hdlc_tty_close()
300 if (tty != n_hdlc->tty) in n_hdlc_tty_close()
303 n_hdlc->tty = n_hdlc->backup_tty; in n_hdlc_tty_close()
322 static int n_hdlc_tty_open (struct tty_struct *tty) in n_hdlc_tty_open() argument
324 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_open()
329 MAJOR(tty->device), MINOR(tty->device)); in n_hdlc_tty_open()
343 tty->disc_data = n_hdlc; in n_hdlc_tty_open()
344 n_hdlc->tty = tty; in n_hdlc_tty_open()
350 set_bit(TTY_NO_WRITE_SPLIT,&tty->flags); in n_hdlc_tty_open()
355 tty_ldisc_flush(tty); in n_hdlc_tty_open()
357 if (tty->driver.flush_buffer) in n_hdlc_tty_open()
358 tty->driver.flush_buffer (tty); in n_hdlc_tty_open()
378 static void n_hdlc_send_frames (struct n_hdlc *n_hdlc, struct tty_struct *tty) in n_hdlc_send_frames() argument
412 tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); in n_hdlc_send_frames()
413 actual = tty->driver.write(tty, 0, tbuf->buf, tbuf->count); in n_hdlc_send_frames()
432 wake_up_interruptible(&tty->write_wait); in n_hdlc_send_frames()
449 tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); in n_hdlc_send_frames()
473 static void n_hdlc_tty_wakeup (struct tty_struct *tty) in n_hdlc_tty_wakeup() argument
475 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_wakeup()
483 if (tty != n_hdlc->tty) { in n_hdlc_tty_wakeup()
484 tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); in n_hdlc_tty_wakeup()
488 n_hdlc_send_frames (n_hdlc, tty); in n_hdlc_tty_wakeup()
501 static int n_hdlc_tty_room (struct tty_struct *tty) in n_hdlc_tty_room() argument
522 static void n_hdlc_tty_receive(struct tty_struct *tty, in n_hdlc_tty_receive() argument
525 register struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_receive()
533 if (n_hdlc == 0 || tty != n_hdlc->tty) in n_hdlc_tty_receive()
574 wake_up_interruptible (&tty->read_wait); in n_hdlc_tty_receive()
575 if (n_hdlc->tty->fasync != NULL) in n_hdlc_tty_receive()
576 kill_fasync (&n_hdlc->tty->fasync, SIGIO, POLL_IN); in n_hdlc_tty_receive()
595 static rw_ret_t n_hdlc_tty_read (struct tty_struct *tty, in n_hdlc_tty_read() argument
598 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); in n_hdlc_tty_read()
619 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) in n_hdlc_tty_read()
622 n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_read()
624 tty != n_hdlc->tty) in n_hdlc_tty_read()
635 interruptible_sleep_on (&tty->read_wait); in n_hdlc_tty_read()
675 static rw_ret_t n_hdlc_tty_write (struct tty_struct *tty, struct file *file, in n_hdlc_tty_write() argument
678 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_write()
704 add_wait_queue(&tty->write_wait, &wait); in n_hdlc_tty_write()
712 n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_write()
714 tty != n_hdlc->tty) { in n_hdlc_tty_write()
727 remove_wait_queue(&tty->write_wait, &wait); in n_hdlc_tty_write()
739 n_hdlc_send_frames(n_hdlc,tty); in n_hdlc_tty_write()
760 static int n_hdlc_tty_ioctl (struct tty_struct *tty, struct file * file, in n_hdlc_tty_ioctl() argument
763 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_ioctl()
791 count = tty->driver.chars_in_buffer ? in n_hdlc_tty_ioctl()
792 tty->driver.chars_in_buffer(tty) : 0; in n_hdlc_tty_ioctl()
802 error = n_tty_ioctl (tty, file, cmd, arg); in n_hdlc_tty_ioctl()
825 static unsigned int n_hdlc_tty_poll (struct tty_struct *tty, in n_hdlc_tty_poll() argument
828 struct n_hdlc *n_hdlc = tty2n_hdlc (tty); in n_hdlc_tty_poll()
834 if (n_hdlc && n_hdlc->magic == HDLC_MAGIC && tty == n_hdlc->tty) { in n_hdlc_tty_poll()
838 poll_wait(filp, &tty->read_wait, wait); in n_hdlc_tty_poll()
839 poll_wait(filp, &tty->write_wait, wait); in n_hdlc_tty_poll()
844 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) in n_hdlc_tty_poll()