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
213 if (tty && C_HUPCL(tty)) in tty_port_shutdown()
235 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()
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 if (tty_io_error(tty)) { in tty_port_block_til_ready()
374 if (C_BAUD(tty)) in tty_port_block_til_ready()
380 if (C_CLOCAL(tty)) in tty_port_block_til_ready()
397 if (C_BAUD(tty) && tty_port_initialized(port)) in tty_port_block_til_ready()
422 tty_unlock(tty); in tty_port_block_til_ready()
424 tty_lock(tty); in tty_port_block_til_ready()
441 static void tty_port_drain_delay(struct tty_port *port, struct tty_struct *tty) in tty_port_drain_delay() argument
443 unsigned int bps = tty_get_baud_rate(tty); in tty_port_drain_delay()
457 struct tty_struct *tty, struct file *filp) in tty_port_close_start() argument
465 if (tty->count == 1 && port->count != 1) { in tty_port_close_start()
466 tty_warn(tty, "%s: tty->count = 1 port count = %d\n", __func__, in tty_port_close_start()
471 tty_warn(tty, "%s: bad port count (%d)\n", __func__, in tty_port_close_start()
482 tty->closing = 1; in tty_port_close_start()
486 if (tty->flow_stopped) in tty_port_close_start()
487 tty_driver_flush_buffer(tty); in tty_port_close_start()
489 tty_wait_until_sent(tty, port->closing_wait); in tty_port_close_start()
491 tty_port_drain_delay(port, tty); in tty_port_close_start()
494 tty_ldisc_flush(tty); in tty_port_close_start()
502 void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) in tty_port_close_end() argument
506 tty_ldisc_flush(tty); in tty_port_close_end()
507 tty->closing = 0; in tty_port_close_end()
528 void tty_port_close(struct tty_port *port, struct tty_struct *tty, in tty_port_close() argument
531 if (tty_port_close_start(port, tty, filp) == 0) in tty_port_close()
533 tty_port_shutdown(port, tty); in tty_port_close()
534 set_bit(TTY_IO_ERROR, &tty->flags); in tty_port_close()
535 tty_port_close_end(port, tty); in tty_port_close()
551 struct tty_struct *tty) in tty_port_install() argument
553 tty->port = port; in tty_port_install()
554 return tty_standard_install(driver, tty); in tty_port_install()
566 int tty_port_open(struct tty_port *port, struct tty_struct *tty, in tty_port_open() argument
572 tty_port_tty_set(port, tty); in tty_port_open()
583 clear_bit(TTY_IO_ERROR, &tty->flags); in tty_port_open()
585 int retval = port->ops->activate(port, tty); in tty_port_open()
594 return tty_port_block_til_ready(port, tty, filp); in tty_port_open()