Lines Matching refs:tty
172 struct tty_struct *tty; in tty_port_tty_get() local
175 tty = tty_kref_get(port->tty); in tty_port_tty_get()
177 return tty; in tty_port_tty_get()
190 void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty) in tty_port_tty_set() argument
195 tty_kref_put(port->tty); in tty_port_tty_set()
196 port->tty = tty_kref_get(tty); in tty_port_tty_set()
201 static void tty_port_shutdown(struct tty_port *port, struct tty_struct *tty) in tty_port_shutdown() argument
212 if (tty && C_HUPCL(tty)) in tty_port_shutdown()
234 struct tty_struct *tty; in tty_port_hangup() local
240 tty = port->tty; in tty_port_hangup()
241 if (tty) in tty_port_hangup()
242 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_hangup()
243 port->tty = NULL; in tty_port_hangup()
245 tty_port_shutdown(port, tty); in tty_port_hangup()
246 tty_kref_put(tty); in tty_port_hangup()
260 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_tty_hangup() local
262 if (tty && (!check_clocal || !C_CLOCAL(tty))) in tty_port_tty_hangup()
263 tty_hangup(tty); in tty_port_tty_hangup()
264 tty_kref_put(tty); in tty_port_tty_hangup()
275 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_tty_wakeup() local
277 if (tty) { in tty_port_tty_wakeup()
278 tty_wakeup(tty); in tty_port_tty_wakeup()
279 tty_kref_put(tty); in tty_port_tty_wakeup()
359 struct tty_struct *tty, struct file *filp) in tty_port_block_til_ready() argument
367 if (tty->flags & (1 << TTY_IO_ERROR)) { in tty_port_block_til_ready()
373 if (tty->termios.c_cflag & CBAUD) in tty_port_block_til_ready()
379 if (C_CLOCAL(tty)) in tty_port_block_til_ready()
396 if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags)) in tty_port_block_til_ready()
421 tty_unlock(tty); in tty_port_block_til_ready()
423 tty_lock(tty); in tty_port_block_til_ready()
440 static void tty_port_drain_delay(struct tty_port *port, struct tty_struct *tty) in tty_port_drain_delay() argument
442 unsigned int bps = tty_get_baud_rate(tty); in tty_port_drain_delay()
456 struct tty_struct *tty, struct file *filp) in tty_port_close_start() argument
464 if (tty->count == 1 && port->count != 1) { in tty_port_close_start()
483 tty->closing = 1; in tty_port_close_start()
487 if (tty->flow_stopped) in tty_port_close_start()
488 tty_driver_flush_buffer(tty); in tty_port_close_start()
490 tty_wait_until_sent(tty, port->closing_wait); in tty_port_close_start()
492 tty_port_drain_delay(port, tty); in tty_port_close_start()
495 tty_ldisc_flush(tty); in tty_port_close_start()
503 void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) in tty_port_close_end() argument
507 tty_ldisc_flush(tty); in tty_port_close_end()
508 tty->closing = 0; in tty_port_close_end()
531 void tty_port_close(struct tty_port *port, struct tty_struct *tty, in tty_port_close() argument
534 if (tty_port_close_start(port, tty, filp) == 0) in tty_port_close()
536 tty_port_shutdown(port, tty); in tty_port_close()
537 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_close()
538 tty_port_close_end(port, tty); in tty_port_close()
554 struct tty_struct *tty) in tty_port_install() argument
556 tty->port = port; in tty_port_install()
557 return tty_standard_install(driver, tty); in tty_port_install()
569 int tty_port_open(struct tty_port *port, struct tty_struct *tty, in tty_port_open() argument
575 tty_port_tty_set(port, tty); in tty_port_open()
586 clear_bit(TTY_IO_ERROR, &tty->flags); in tty_port_open()
588 int retval = port->ops->activate(port, tty); in tty_port_open()
597 return tty_port_block_til_ready(port, tty, filp); in tty_port_open()