Lines Matching refs:tty
28 struct tty_struct *tty; in tty_port_default_receive_buf() local
31 tty = READ_ONCE(port->itty); in tty_port_default_receive_buf()
32 if (!tty) in tty_port_default_receive_buf()
35 disc = tty_ldisc_ref(tty); in tty_port_default_receive_buf()
49 struct tty_struct *tty; in tty_port_default_lookahead_buf() local
52 tty = READ_ONCE(port->itty); in tty_port_default_lookahead_buf()
53 if (!tty) in tty_port_default_lookahead_buf()
56 disc = tty_ldisc_ref(tty); in tty_port_default_lookahead_buf()
61 disc->ops->lookahead_buf(disc->tty, p, f, count); in tty_port_default_lookahead_buf()
68 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_default_wakeup() local
70 if (tty) { in tty_port_default_wakeup()
71 tty_wakeup(tty); in tty_port_default_wakeup()
72 tty_kref_put(tty); in tty_port_default_wakeup()
325 struct tty_struct *tty; in tty_port_tty_get() local
328 tty = tty_kref_get(port->tty); in tty_port_tty_get()
330 return tty; in tty_port_tty_get()
342 void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty) in tty_port_tty_set() argument
347 tty_kref_put(port->tty); in tty_port_tty_set()
348 port->tty = tty_kref_get(tty); in tty_port_tty_set()
363 static void tty_port_shutdown(struct tty_port *port, struct tty_struct *tty) in tty_port_shutdown() argument
375 if (tty && C_HUPCL(tty)) in tty_port_shutdown()
396 struct tty_struct *tty; in tty_port_hangup() local
401 tty = port->tty; in tty_port_hangup()
402 if (tty) in tty_port_hangup()
403 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_hangup()
404 port->tty = NULL; in tty_port_hangup()
407 tty_port_shutdown(port, tty); in tty_port_hangup()
408 tty_kref_put(tty); in tty_port_hangup()
421 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_tty_hangup() local
423 if (tty && (!check_clocal || !C_CLOCAL(tty))) in tty_port_tty_hangup()
424 tty_hangup(tty); in tty_port_tty_hangup()
425 tty_kref_put(tty); in tty_port_tty_hangup()
511 struct tty_struct *tty, struct file *filp) in tty_port_block_til_ready() argument
520 if (tty_io_error(tty)) { in tty_port_block_til_ready()
526 if (C_BAUD(tty)) in tty_port_block_til_ready()
532 if (C_CLOCAL(tty)) in tty_port_block_til_ready()
550 if (C_BAUD(tty) && tty_port_initialized(port)) in tty_port_block_til_ready()
576 tty_unlock(tty); in tty_port_block_til_ready()
578 tty_lock(tty); in tty_port_block_til_ready()
596 static void tty_port_drain_delay(struct tty_port *port, struct tty_struct *tty) in tty_port_drain_delay() argument
598 unsigned int bps = tty_get_baud_rate(tty); in tty_port_drain_delay()
626 struct tty_struct *tty, struct file *filp) in tty_port_close_start() argument
634 if (tty->count == 1 && port->count != 1) { in tty_port_close_start()
635 tty_warn(tty, "%s: tty->count = 1 port count = %d\n", __func__, in tty_port_close_start()
640 tty_warn(tty, "%s: bad port count (%d)\n", __func__, in tty_port_close_start()
651 tty->closing = 1; in tty_port_close_start()
655 if (tty->flow.tco_stopped) in tty_port_close_start()
656 tty_driver_flush_buffer(tty); in tty_port_close_start()
658 tty_wait_until_sent(tty, port->closing_wait); in tty_port_close_start()
660 tty_port_drain_delay(port, tty); in tty_port_close_start()
663 tty_ldisc_flush(tty); in tty_port_close_start()
681 void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) in tty_port_close_end() argument
685 tty_ldisc_flush(tty); in tty_port_close_end()
686 tty->closing = 0; in tty_port_close_end()
715 void tty_port_close(struct tty_port *port, struct tty_struct *tty, in tty_port_close() argument
718 if (tty_port_close_start(port, tty, filp) == 0) in tty_port_close()
720 tty_port_shutdown(port, tty); in tty_port_close()
722 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_close()
723 tty_port_close_end(port, tty); in tty_port_close()
739 struct tty_struct *tty) in tty_port_install() argument
741 tty->port = port; in tty_port_install()
742 return tty_standard_install(driver, tty); in tty_port_install()
765 int tty_port_open(struct tty_port *port, struct tty_struct *tty, in tty_port_open() argument
771 tty_port_tty_set(port, tty); in tty_port_open()
782 clear_bit(TTY_IO_ERROR, &tty->flags); in tty_port_open()
784 int retval = port->ops->activate(port, tty); in tty_port_open()
794 return tty_port_block_til_ready(port, tty, filp); in tty_port_open()