Lines Matching refs:tty

27 	struct tty_struct *tty;  in tty_port_default_receive_buf()  local
30 tty = READ_ONCE(port->itty); in tty_port_default_receive_buf()
31 if (!tty) in tty_port_default_receive_buf()
34 disc = tty_ldisc_ref(tty); in tty_port_default_receive_buf()
47 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_default_wakeup() local
49 if (tty) { in tty_port_default_wakeup()
50 tty_wakeup(tty); in tty_port_default_wakeup()
51 tty_kref_put(tty); in tty_port_default_wakeup()
286 struct tty_struct *tty; in tty_port_tty_get() local
289 tty = tty_kref_get(port->tty); in tty_port_tty_get()
291 return tty; in tty_port_tty_get()
303 void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty) in tty_port_tty_set() argument
308 tty_kref_put(port->tty); in tty_port_tty_set()
309 port->tty = tty_kref_get(tty); in tty_port_tty_set()
314 static void tty_port_shutdown(struct tty_port *port, struct tty_struct *tty) in tty_port_shutdown() argument
326 if (tty && C_HUPCL(tty)) in tty_port_shutdown()
347 struct tty_struct *tty; in tty_port_hangup() local
352 tty = port->tty; in tty_port_hangup()
353 if (tty) in tty_port_hangup()
354 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_hangup()
355 port->tty = NULL; in tty_port_hangup()
358 tty_port_shutdown(port, tty); in tty_port_hangup()
359 tty_kref_put(tty); in tty_port_hangup()
373 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_tty_hangup() local
375 if (tty && (!check_clocal || !C_CLOCAL(tty))) in tty_port_tty_hangup()
376 tty_hangup(tty); in tty_port_tty_hangup()
377 tty_kref_put(tty); in tty_port_tty_hangup()
463 struct tty_struct *tty, struct file *filp) in tty_port_block_til_ready() argument
471 if (tty_io_error(tty)) { in tty_port_block_til_ready()
477 if (C_BAUD(tty)) in tty_port_block_til_ready()
483 if (C_CLOCAL(tty)) in tty_port_block_til_ready()
500 if (C_BAUD(tty) && tty_port_initialized(port)) in tty_port_block_til_ready()
525 tty_unlock(tty); in tty_port_block_til_ready()
527 tty_lock(tty); in tty_port_block_til_ready()
544 static void tty_port_drain_delay(struct tty_port *port, struct tty_struct *tty) in tty_port_drain_delay() argument
546 unsigned int bps = tty_get_baud_rate(tty); in tty_port_drain_delay()
560 struct tty_struct *tty, struct file *filp) in tty_port_close_start() argument
568 if (tty->count == 1 && port->count != 1) { in tty_port_close_start()
569 tty_warn(tty, "%s: tty->count = 1 port count = %d\n", __func__, in tty_port_close_start()
574 tty_warn(tty, "%s: bad port count (%d)\n", __func__, in tty_port_close_start()
585 tty->closing = 1; in tty_port_close_start()
589 if (tty->flow_stopped) in tty_port_close_start()
590 tty_driver_flush_buffer(tty); in tty_port_close_start()
592 tty_wait_until_sent(tty, port->closing_wait); in tty_port_close_start()
594 tty_port_drain_delay(port, tty); in tty_port_close_start()
597 tty_ldisc_flush(tty); in tty_port_close_start()
605 void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) in tty_port_close_end() argument
609 tty_ldisc_flush(tty); in tty_port_close_end()
610 tty->closing = 0; in tty_port_close_end()
631 void tty_port_close(struct tty_port *port, struct tty_struct *tty, in tty_port_close() argument
634 if (tty_port_close_start(port, tty, filp) == 0) in tty_port_close()
636 tty_port_shutdown(port, tty); in tty_port_close()
638 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_close()
639 tty_port_close_end(port, tty); in tty_port_close()
655 struct tty_struct *tty) in tty_port_install() argument
657 tty->port = port; in tty_port_install()
658 return tty_standard_install(driver, tty); in tty_port_install()
670 int tty_port_open(struct tty_port *port, struct tty_struct *tty, in tty_port_open() argument
676 tty_port_tty_set(port, tty); in tty_port_open()
687 clear_bit(TTY_IO_ERROR, &tty->flags); in tty_port_open()
689 int retval = port->ops->activate(port, tty); in tty_port_open()
698 return tty_port_block_til_ready(port, tty, filp); in tty_port_open()