Lines Matching refs:tty

26 	struct tty_struct *tty;  in tty_port_default_receive_buf()  local
29 tty = READ_ONCE(port->itty); in tty_port_default_receive_buf()
30 if (!tty) in tty_port_default_receive_buf()
33 ld = tty_ldisc_ref(tty); in tty_port_default_receive_buf()
47 struct tty_struct *tty; in tty_port_default_lookahead_buf() local
50 tty = READ_ONCE(port->itty); in tty_port_default_lookahead_buf()
51 if (!tty) in tty_port_default_lookahead_buf()
54 ld = tty_ldisc_ref(tty); in tty_port_default_lookahead_buf()
59 ld->ops->lookahead_buf(ld->tty, p, f, count); in tty_port_default_lookahead_buf()
66 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_default_wakeup() local
68 if (tty) { in tty_port_default_wakeup()
69 tty_wakeup(tty); in tty_port_default_wakeup()
70 tty_kref_put(tty); in tty_port_default_wakeup()
323 struct tty_struct *tty; in tty_port_tty_get() local
326 tty = tty_kref_get(port->tty); in tty_port_tty_get()
328 return tty; in tty_port_tty_get()
340 void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty) in tty_port_tty_set() argument
345 tty_kref_put(port->tty); in tty_port_tty_set()
346 port->tty = tty_kref_get(tty); in tty_port_tty_set()
361 static void tty_port_shutdown(struct tty_port *port, struct tty_struct *tty) in tty_port_shutdown() argument
373 if (tty && C_HUPCL(tty)) in tty_port_shutdown()
394 struct tty_struct *tty; in tty_port_hangup() local
399 tty = port->tty; in tty_port_hangup()
400 if (tty) in tty_port_hangup()
401 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_hangup()
402 port->tty = NULL; in tty_port_hangup()
405 tty_port_shutdown(port, tty); in tty_port_hangup()
406 tty_kref_put(tty); in tty_port_hangup()
419 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_tty_hangup() local
421 if (tty && (!check_clocal || !C_CLOCAL(tty))) in tty_port_tty_hangup()
422 tty_hangup(tty); in tty_port_tty_hangup()
423 tty_kref_put(tty); in tty_port_tty_hangup()
509 struct tty_struct *tty, struct file *filp) in tty_port_block_til_ready() argument
518 if (tty_io_error(tty)) { in tty_port_block_til_ready()
524 if (C_BAUD(tty)) in tty_port_block_til_ready()
530 if (C_CLOCAL(tty)) in tty_port_block_til_ready()
548 if (C_BAUD(tty) && tty_port_initialized(port)) in tty_port_block_til_ready()
574 tty_unlock(tty); in tty_port_block_til_ready()
576 tty_lock(tty); in tty_port_block_til_ready()
594 static void tty_port_drain_delay(struct tty_port *port, struct tty_struct *tty) in tty_port_drain_delay() argument
596 unsigned int bps = tty_get_baud_rate(tty); in tty_port_drain_delay()
624 struct tty_struct *tty, struct file *filp) in tty_port_close_start() argument
632 if (tty->count == 1 && port->count != 1) { in tty_port_close_start()
633 tty_warn(tty, "%s: tty->count = 1 port count = %d\n", __func__, in tty_port_close_start()
638 tty_warn(tty, "%s: bad port count (%d)\n", __func__, in tty_port_close_start()
649 tty->closing = 1; in tty_port_close_start()
653 if (tty->flow.tco_stopped) in tty_port_close_start()
654 tty_driver_flush_buffer(tty); in tty_port_close_start()
656 tty_wait_until_sent(tty, port->closing_wait); in tty_port_close_start()
658 tty_port_drain_delay(port, tty); in tty_port_close_start()
661 tty_ldisc_flush(tty); in tty_port_close_start()
679 void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) in tty_port_close_end() argument
683 tty_ldisc_flush(tty); in tty_port_close_end()
684 tty->closing = 0; in tty_port_close_end()
713 void tty_port_close(struct tty_port *port, struct tty_struct *tty, in tty_port_close() argument
716 if (tty_port_close_start(port, tty, filp) == 0) in tty_port_close()
718 tty_port_shutdown(port, tty); in tty_port_close()
720 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_close()
721 tty_port_close_end(port, tty); in tty_port_close()
737 struct tty_struct *tty) in tty_port_install() argument
739 tty->port = port; in tty_port_install()
740 return tty_standard_install(driver, tty); in tty_port_install()
763 int tty_port_open(struct tty_port *port, struct tty_struct *tty, in tty_port_open() argument
769 tty_port_tty_set(port, tty); in tty_port_open()
780 clear_bit(TTY_IO_ERROR, &tty->flags); in tty_port_open()
782 int retval = port->ops->activate(port, tty); in tty_port_open()
792 return tty_port_block_til_ready(port, tty, filp); in tty_port_open()