Lines Matching refs:tty
173 struct tty_struct *tty; in tty_port_tty_get() local
176 tty = tty_kref_get(port->tty); in tty_port_tty_get()
178 return tty; in tty_port_tty_get()
191 void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty) in tty_port_tty_set() argument
196 tty_kref_put(port->tty); in tty_port_tty_set()
197 port->tty = tty_kref_get(tty); in tty_port_tty_set()
202 static void tty_port_shutdown(struct tty_port *port, struct tty_struct *tty) in tty_port_shutdown() argument
213 if (tty && C_HUPCL(tty)) in tty_port_shutdown()
235 struct tty_struct *tty; in tty_port_hangup() local
241 tty = port->tty; in tty_port_hangup()
242 if (tty) in tty_port_hangup()
243 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_hangup()
244 port->tty = NULL; in tty_port_hangup()
246 tty_port_shutdown(port, tty); in tty_port_hangup()
247 tty_kref_put(tty); in tty_port_hangup()
261 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_tty_hangup() local
263 if (tty && (!check_clocal || !C_CLOCAL(tty))) in tty_port_tty_hangup()
264 tty_hangup(tty); in tty_port_tty_hangup()
265 tty_kref_put(tty); in tty_port_tty_hangup()
276 struct tty_struct *tty = tty_port_tty_get(port); in tty_port_tty_wakeup() local
278 if (tty) { in tty_port_tty_wakeup()
279 tty_wakeup(tty); in tty_port_tty_wakeup()
280 tty_kref_put(tty); in tty_port_tty_wakeup()
360 struct tty_struct *tty, struct file *filp) in tty_port_block_til_ready() argument
368 wait_event_interruptible_tty(tty, port->close_wait, in tty_port_block_til_ready()
378 if (tty->flags & (1 << TTY_IO_ERROR)) { in tty_port_block_til_ready()
384 if (tty->termios.c_cflag & CBAUD) in tty_port_block_til_ready()
390 if (C_CLOCAL(tty)) in tty_port_block_til_ready()
407 if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags)) in tty_port_block_til_ready()
433 tty_unlock(tty); in tty_port_block_til_ready()
435 tty_lock(tty); in tty_port_block_til_ready()
452 static void tty_port_drain_delay(struct tty_port *port, struct tty_struct *tty) in tty_port_drain_delay() argument
454 unsigned int bps = tty_get_baud_rate(tty); in tty_port_drain_delay()
471 struct tty_struct *tty, struct file *filp) in tty_port_close_start() argument
479 if (tty->count == 1 && port->count != 1) { in tty_port_close_start()
498 tty->closing = 1; in tty_port_close_start()
502 if (tty->flow_stopped) in tty_port_close_start()
503 tty_driver_flush_buffer(tty); in tty_port_close_start()
505 tty_wait_until_sent_from_close(tty, port->closing_wait); in tty_port_close_start()
507 tty_port_drain_delay(port, tty); in tty_port_close_start()
510 tty_ldisc_flush(tty); in tty_port_close_start()
518 void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) in tty_port_close_end() argument
522 tty_ldisc_flush(tty); in tty_port_close_end()
523 tty->closing = 0; in tty_port_close_end()
551 void tty_port_close(struct tty_port *port, struct tty_struct *tty, in tty_port_close() argument
554 if (tty_port_close_start(port, tty, filp) == 0) in tty_port_close()
556 tty_port_shutdown(port, tty); in tty_port_close()
557 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_close()
558 tty_port_close_end(port, tty); in tty_port_close()
574 struct tty_struct *tty) in tty_port_install() argument
576 tty->port = port; in tty_port_install()
577 return tty_standard_install(driver, tty); in tty_port_install()
589 int tty_port_open(struct tty_port *port, struct tty_struct *tty, in tty_port_open() argument
595 tty_port_tty_set(port, tty); in tty_port_open()
606 clear_bit(TTY_IO_ERROR, &tty->flags); in tty_port_open()
608 int retval = port->ops->activate(port, tty); in tty_port_open()
617 return tty_port_block_til_ready(port, tty, filp); in tty_port_open()