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()
304 void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty) in tty_port_tty_set() argument
309 tty_kref_put(port->tty); in tty_port_tty_set()
310 port->tty = tty_kref_get(tty); in tty_port_tty_set()
315 static void tty_port_shutdown(struct tty_port *port, struct tty_struct *tty) in tty_port_shutdown() argument
327 if (tty && C_HUPCL(tty)) in tty_port_shutdown()
349 struct tty_struct *tty; in tty_port_hangup() local
354 tty = port->tty; in tty_port_hangup()
355 if (tty) in tty_port_hangup()
356 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_hangup()
357 port->tty = NULL; in tty_port_hangup()
360 tty_port_shutdown(port, tty); in tty_port_hangup()
361 tty_kref_put(tty); in tty_port_hangup()
375 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_tty_hangup() local
377 if (tty && (!check_clocal || !C_CLOCAL(tty))) in tty_port_tty_hangup()
378 tty_hangup(tty); in tty_port_tty_hangup()
379 tty_kref_put(tty); in tty_port_tty_hangup()
469 struct tty_struct *tty, struct file *filp) in tty_port_block_til_ready() argument
477 if (tty_io_error(tty)) { in tty_port_block_til_ready()
483 if (C_BAUD(tty)) in tty_port_block_til_ready()
489 if (C_CLOCAL(tty)) in tty_port_block_til_ready()
506 if (C_BAUD(tty) && tty_port_initialized(port)) in tty_port_block_til_ready()
531 tty_unlock(tty); in tty_port_block_til_ready()
533 tty_lock(tty); in tty_port_block_til_ready()
550 static void tty_port_drain_delay(struct tty_port *port, struct tty_struct *tty) in tty_port_drain_delay() argument
552 unsigned int bps = tty_get_baud_rate(tty); in tty_port_drain_delay()
566 struct tty_struct *tty, struct file *filp) in tty_port_close_start() argument
574 if (tty->count == 1 && port->count != 1) { in tty_port_close_start()
575 tty_warn(tty, "%s: tty->count = 1 port count = %d\n", __func__, in tty_port_close_start()
580 tty_warn(tty, "%s: bad port count (%d)\n", __func__, in tty_port_close_start()
591 tty->closing = 1; in tty_port_close_start()
595 if (tty->flow_stopped) in tty_port_close_start()
596 tty_driver_flush_buffer(tty); in tty_port_close_start()
598 tty_wait_until_sent(tty, port->closing_wait); in tty_port_close_start()
600 tty_port_drain_delay(port, tty); in tty_port_close_start()
603 tty_ldisc_flush(tty); in tty_port_close_start()
611 void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) in tty_port_close_end() argument
615 tty_ldisc_flush(tty); in tty_port_close_end()
616 tty->closing = 0; in tty_port_close_end()
637 void tty_port_close(struct tty_port *port, struct tty_struct *tty, in tty_port_close() argument
640 if (tty_port_close_start(port, tty, filp) == 0) in tty_port_close()
642 tty_port_shutdown(port, tty); in tty_port_close()
643 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_close()
644 tty_port_close_end(port, tty); in tty_port_close()
660 struct tty_struct *tty) in tty_port_install() argument
662 tty->port = port; in tty_port_install()
663 return tty_standard_install(driver, tty); in tty_port_install()
675 int tty_port_open(struct tty_port *port, struct tty_struct *tty, in tty_port_open() argument
681 tty_port_tty_set(port, tty); in tty_port_open()
692 clear_bit(TTY_IO_ERROR, &tty->flags); in tty_port_open()
694 int retval = port->ops->activate(port, tty); in tty_port_open()
703 return tty_port_block_til_ready(port, tty, filp); in tty_port_open()