Lines Matching refs:tty
27 struct tty_struct *tty; /* only populated while dev is open */ member
277 static int vcc_rx_check(struct tty_struct *tty, int size) in vcc_rx_check() argument
279 if (WARN_ON(!tty || !tty->port)) in vcc_rx_check()
285 if (test_bit(TTY_THROTTLED, &tty->flags) || in vcc_rx_check()
286 (tty_buffer_request_room(tty->port, VCC_BUFF_LEN) < VCC_BUFF_LEN)) in vcc_rx_check()
292 static int vcc_rx(struct tty_struct *tty, char *buf, int size) in vcc_rx() argument
296 if (WARN_ON(!tty || !tty->port)) in vcc_rx()
299 len = tty_insert_flip_string(tty->port, buf, size); in vcc_rx()
301 tty_flip_buffer_push(tty->port); in vcc_rx()
309 struct tty_struct *tty; in vcc_ldc_read() local
313 tty = port->tty; in vcc_ldc_read()
314 if (!tty) { in vcc_ldc_read()
322 if (!vcc_rx_check(tty, VIO_VCC_MTU_SIZE)) { in vcc_ldc_read()
341 vcc_rx(tty, pkt.data, pkt.tag.stype); in vcc_ldc_read()
371 if (!port->tty || port->removed) in vcc_rx_timer()
394 if (!port->tty || port->removed) in vcc_tx_timer()
413 struct tty_struct *tty = port->tty; in vcc_tx_timer() local
416 if (tty) in vcc_tx_timer()
417 tty_wakeup(tty); in vcc_tx_timer()
693 if (port->tty) in vcc_remove()
694 tty_vhangup(port->tty); in vcc_remove()
707 if (port->tty) { in vcc_remove()
734 static int vcc_open(struct tty_struct *tty, struct file *vcc_file) in vcc_open() argument
738 if (tty->count > 1) in vcc_open()
741 port = vcc_get_ne(tty->index); in vcc_open()
756 if (unlikely(!tty->port)) { in vcc_open()
761 if (unlikely(!tty->port->ops)) { in vcc_open()
766 return tty_port_open(tty->port, tty, vcc_file); in vcc_open()
769 static void vcc_close(struct tty_struct *tty, struct file *vcc_file) in vcc_close() argument
771 if (unlikely(tty->count > 1)) in vcc_close()
774 if (unlikely(!tty->port)) { in vcc_close()
779 tty_port_close(tty->port, tty, vcc_file); in vcc_close()
794 static void vcc_hangup(struct tty_struct *tty) in vcc_hangup() argument
798 port = vcc_get_ne(tty->index); in vcc_hangup()
804 if (unlikely(!tty->port)) { in vcc_hangup()
814 tty_port_hangup(tty->port); in vcc_hangup()
817 static ssize_t vcc_write(struct tty_struct *tty, const u8 *buf, size_t count) in vcc_write() argument
826 port = vcc_get_ne(tty->index); in vcc_write()
882 static unsigned int vcc_write_room(struct tty_struct *tty) in vcc_write_room() argument
887 port = vcc_get_ne(tty->index); in vcc_write_room()
900 static unsigned int vcc_chars_in_buffer(struct tty_struct *tty) in vcc_chars_in_buffer() argument
905 port = vcc_get_ne(tty->index); in vcc_chars_in_buffer()
918 static int vcc_break_ctl(struct tty_struct *tty, int state) in vcc_break_ctl() argument
923 port = vcc_get_ne(tty->index); in vcc_break_ctl()
947 static int vcc_install(struct tty_driver *driver, struct tty_struct *tty) in vcc_install() argument
953 if (tty->index >= VCC_MAX_PORTS) in vcc_install()
956 ret = tty_standard_install(driver, tty); in vcc_install()
964 port_vcc = vcc_get(tty->index, true); in vcc_install()
967 tty->port = NULL; in vcc_install()
974 tty->port = port_tty; in vcc_install()
976 port_vcc->tty = tty; in vcc_install()
983 static void vcc_cleanup(struct tty_struct *tty) in vcc_cleanup() argument
987 port = vcc_get(tty->index, true); in vcc_cleanup()
989 port->tty = NULL; in vcc_cleanup()
992 vcc_table_remove(tty->index); in vcc_cleanup()
1001 tty_port_destroy(tty->port); in vcc_cleanup()
1002 kfree(tty->port); in vcc_cleanup()
1003 tty->port = NULL; in vcc_cleanup()