Lines Matching refs:tty
32 struct tty_struct *tty; /* only populated while dev is open */ member
284 static int vcc_rx_check(struct tty_struct *tty, int size) in vcc_rx_check() argument
286 if (WARN_ON(!tty || !tty->port)) in vcc_rx_check()
292 if (test_bit(TTY_THROTTLED, &tty->flags) || in vcc_rx_check()
293 (tty_buffer_request_room(tty->port, VCC_BUFF_LEN) < VCC_BUFF_LEN)) in vcc_rx_check()
299 static int vcc_rx(struct tty_struct *tty, char *buf, int size) in vcc_rx() argument
303 if (WARN_ON(!tty || !tty->port)) in vcc_rx()
306 len = tty_insert_flip_string(tty->port, buf, size); in vcc_rx()
308 tty_flip_buffer_push(tty->port); in vcc_rx()
316 struct tty_struct *tty; in vcc_ldc_read() local
320 tty = port->tty; in vcc_ldc_read()
321 if (!tty) { in vcc_ldc_read()
329 if (!vcc_rx_check(tty, VIO_VCC_MTU_SIZE)) { in vcc_ldc_read()
348 vcc_rx(tty, pkt.data, pkt.tag.stype); in vcc_ldc_read()
378 if (!port->tty || port->removed) in vcc_rx_timer()
401 if (!port->tty || port->removed) in vcc_tx_timer()
420 struct tty_struct *tty = port->tty; in vcc_tx_timer() local
423 if (tty) in vcc_tx_timer()
424 tty_wakeup(tty); in vcc_tx_timer()
692 if (port->tty) in vcc_remove()
693 tty_vhangup(port->tty); in vcc_remove()
709 if (port->tty) { in vcc_remove()
738 static int vcc_open(struct tty_struct *tty, struct file *vcc_file) in vcc_open() argument
742 if (unlikely(!tty)) { in vcc_open()
747 if (tty->count > 1) in vcc_open()
750 port = vcc_get_ne(tty->index); in vcc_open()
765 if (unlikely(!tty->port)) { in vcc_open()
770 if (unlikely(!tty->port->ops)) { in vcc_open()
775 return tty_port_open(tty->port, tty, vcc_file); in vcc_open()
778 static void vcc_close(struct tty_struct *tty, struct file *vcc_file) in vcc_close() argument
780 if (unlikely(!tty)) { in vcc_close()
785 if (unlikely(tty->count > 1)) in vcc_close()
788 if (unlikely(!tty->port)) { in vcc_close()
793 tty_port_close(tty->port, tty, vcc_file); in vcc_close()
808 static void vcc_hangup(struct tty_struct *tty) in vcc_hangup() argument
812 if (unlikely(!tty)) { in vcc_hangup()
817 port = vcc_get_ne(tty->index); in vcc_hangup()
823 if (unlikely(!tty->port)) { in vcc_hangup()
833 tty_port_hangup(tty->port); in vcc_hangup()
836 static int vcc_write(struct tty_struct *tty, const unsigned char *buf, in vcc_write() argument
846 if (unlikely(!tty)) { in vcc_write()
851 port = vcc_get_ne(tty->index); in vcc_write()
906 static int vcc_write_room(struct tty_struct *tty) in vcc_write_room() argument
911 if (unlikely(!tty)) { in vcc_write_room()
916 port = vcc_get_ne(tty->index); in vcc_write_room()
929 static int vcc_chars_in_buffer(struct tty_struct *tty) in vcc_chars_in_buffer() argument
934 if (unlikely(!tty)) { in vcc_chars_in_buffer()
939 port = vcc_get_ne(tty->index); in vcc_chars_in_buffer()
952 static int vcc_break_ctl(struct tty_struct *tty, int state) in vcc_break_ctl() argument
957 if (unlikely(!tty)) { in vcc_break_ctl()
962 port = vcc_get_ne(tty->index); in vcc_break_ctl()
986 static int vcc_install(struct tty_driver *driver, struct tty_struct *tty) in vcc_install() argument
992 if (unlikely(!tty)) { in vcc_install()
997 if (tty->index >= VCC_MAX_PORTS) in vcc_install()
1000 ret = tty_standard_install(driver, tty); in vcc_install()
1008 port_vcc = vcc_get(tty->index, true); in vcc_install()
1011 tty->port = NULL; in vcc_install()
1018 tty->port = port_tty; in vcc_install()
1020 port_vcc->tty = tty; in vcc_install()
1027 static void vcc_cleanup(struct tty_struct *tty) in vcc_cleanup() argument
1031 if (unlikely(!tty)) { in vcc_cleanup()
1036 port = vcc_get(tty->index, true); in vcc_cleanup()
1038 port->tty = NULL; in vcc_cleanup()
1041 vcc_table_remove(tty->index); in vcc_cleanup()
1050 tty_port_destroy(tty->port); in vcc_cleanup()
1051 kfree(tty->port); in vcc_cleanup()
1052 tty->port = NULL; in vcc_cleanup()