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()
48 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_default_wakeup() local
50 if (tty) { in tty_port_default_wakeup()
51 tty_wakeup(tty); in tty_port_default_wakeup()
52 tty_kref_put(tty); in tty_port_default_wakeup()
287 struct tty_struct *tty; in tty_port_tty_get() local
290 tty = tty_kref_get(port->tty); in tty_port_tty_get()
292 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()
348 struct tty_struct *tty; in tty_port_hangup() local
353 tty = port->tty; in tty_port_hangup()
354 if (tty) in tty_port_hangup()
355 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_hangup()
356 port->tty = NULL; in tty_port_hangup()
359 tty_port_shutdown(port, tty); in tty_port_hangup()
360 tty_kref_put(tty); in tty_port_hangup()
374 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_tty_hangup() local
376 if (tty && (!check_clocal || !C_CLOCAL(tty))) in tty_port_tty_hangup()
377 tty_hangup(tty); in tty_port_tty_hangup()
378 tty_kref_put(tty); in tty_port_tty_hangup()
464 struct tty_struct *tty, struct file *filp) in tty_port_block_til_ready() argument
473 if (tty_io_error(tty)) { in tty_port_block_til_ready()
479 if (C_BAUD(tty)) in tty_port_block_til_ready()
485 if (C_CLOCAL(tty)) in tty_port_block_til_ready()
503 if (C_BAUD(tty) && tty_port_initialized(port)) in tty_port_block_til_ready()
529 tty_unlock(tty); in tty_port_block_til_ready()
531 tty_lock(tty); in tty_port_block_til_ready()
549 static void tty_port_drain_delay(struct tty_port *port, struct tty_struct *tty) in tty_port_drain_delay() argument
551 unsigned int bps = tty_get_baud_rate(tty); in tty_port_drain_delay()
565 struct tty_struct *tty, struct file *filp) in tty_port_close_start() argument
573 if (tty->count == 1 && port->count != 1) { in tty_port_close_start()
574 tty_warn(tty, "%s: tty->count = 1 port count = %d\n", __func__, in tty_port_close_start()
579 tty_warn(tty, "%s: bad port count (%d)\n", __func__, in tty_port_close_start()
590 tty->closing = 1; in tty_port_close_start()
594 if (tty->flow.tco_stopped) in tty_port_close_start()
595 tty_driver_flush_buffer(tty); in tty_port_close_start()
597 tty_wait_until_sent(tty, port->closing_wait); in tty_port_close_start()
599 tty_port_drain_delay(port, tty); in tty_port_close_start()
602 tty_ldisc_flush(tty); in tty_port_close_start()
610 void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) in tty_port_close_end() argument
614 tty_ldisc_flush(tty); in tty_port_close_end()
615 tty->closing = 0; in tty_port_close_end()
636 void tty_port_close(struct tty_port *port, struct tty_struct *tty, in tty_port_close() argument
639 if (tty_port_close_start(port, tty, filp) == 0) in tty_port_close()
641 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()
704 return tty_port_block_til_ready(port, tty, filp); in tty_port_open()