Lines Matching refs:tty

3  * n_gsm.c GSM 0710 tty multiplexor
10 * tty -> DLCI fifo -> scheduler -> GSM MUX data queue ---o-> ldisc
14 * ldisc -> gsm_queue() -o--> tty
19 * Partly done: hooks so you can pull off frames to non tty devs
27 * Use newest tty open/close port helpers and install hooks
30 * Do we need a 'which mux are you' ioctl to correlate mux and tty sets
41 #include <linux/tty.h>
65 #include "tty.h"
147 * the link layer to an optional tty (if the tty side is open). To avoid
166 /* Uplink tty if active */
167 struct tty_port port; /* The tty bound to this DLCI if there is one */
269 * To consider further: tty open versus mux shutdown.
273 struct tty_struct *tty; /* The tty our ldisc is bound to */
352 * Mux objects - needed so that we can translate a tty index into the
540 * the current status of the DLCI and attached tty object
636 * gsm_register_devices - register all tty devices for a given mux index
638 * @driver: the tty driver that describes the tty devices
655 * and not a usable tty interface
672 * gsm_unregister_devices - unregister all tty devices for a given mux index
674 * @driver: the tty driver that describes the tty devices
691 * channel and not a usable tty interface
1010 * The tty device has called us to indicate that room has appeared in
1022 clear_bit(TTY_DO_WRITE_WAKEUP, &gsm->tty->flags);
1090 * out of the mux tty if not already doing so. The Caller must hold
1154 * out of the mux tty if not already doing so. Take the
1172 * is data. Keep to the MRU of the mux. This path handles the usual tty
1413 * a tty wakeup except when we filled the pipe so we need to fire off
1498 * @tty: virtual tty bound to the DLCI
1507 static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci,
1547 if (tty) {
1549 if (!C_CLOCAL(tty))
1550 tty_hangup(tty);
1678 * and if need be stuff a break message down the tty.
1689 struct tty_struct *tty;
1713 tty = tty_port_tty_get(&dlci->port);
1714 gsm_process_modem(tty, dlci, modem, cl);
1715 if (tty) {
1716 tty_wakeup(tty);
1717 tty_kref_put(tty);
1797 * this into the uplink tty if present
2129 * is an attached tty this is hung up
2170 /* This will let a tty open continue */
2395 * other than the control channel. If the relevant virtual tty is
2403 struct tty_struct *tty;
2408 pr_debug("%d bytes for tty\n", clen);
2419 tty = tty_port_tty_get(port);
2420 if (tty) {
2421 gsm_process_modem(tty, dlci, modem, len);
2422 tty_wakeup(tty);
2423 tty_kref_put(tty);
2482 * a tty wakeup except when we filled the pipe so we need to fire off
2681 * @port: tty port for DLCI to free
2716 * mux is closed or tty is closed - whichever is last.
2722 struct tty_struct *tty = tty_port_tty_get(&dlci->port);
2723 if (tty) {
2728 /* We cannot use tty_hangup() because in tty_kref_put() the tty
2733 tty_vhangup(tty);
2736 tty_kref_put(tty);
3098 * gsm_error - handle tty error
3159 tty_ldisc_flush(gsm->tty);
3308 gsm->dead = true; /* Avoid early tty opens */
3509 if (tty_write_room(gsm->tty) < len) {
3510 set_bit(TTY_DO_WRITE_WAKEUP, &gsm->tty->flags);
3515 return gsm->tty->ops->write(gsm->tty, data, len);
3549 if (gsm->tty)
3561 * @tty: our tty structure
3569 static void gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
3571 gsm->tty = tty_kref_get(tty);
3572 /* Turn off tty XON/XOFF handling to handle it explicitly. */
3573 gsm->old_c_iflag = tty->termios.c_iflag;
3574 tty->termios.c_iflag &= (IXON | IXOFF);
3579 * @tty: tty attached to the mux
3585 static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
3587 WARN_ON(tty != gsm->tty);
3588 /* Restore tty XON/XOFF handling. */
3589 gsm->tty->termios.c_iflag = gsm->old_c_iflag;
3590 tty_kref_put(gsm->tty);
3591 gsm->tty = NULL;
3594 static void gsmld_receive_buf(struct tty_struct *tty, const u8 *cp,
3597 struct gsm_mux *gsm = tty->disc_data;
3619 tty_name(tty), flags);
3624 /* If clogged call tty_throttle(tty); */
3629 * @tty: terminal device
3632 * being closed, when the tty layer wants the buffer flushed (eg
3636 static void gsmld_flush_buffer(struct tty_struct *tty)
3641 * gsmld_close - close the ldisc for this tty
3642 * @tty: device
3650 static void gsmld_close(struct tty_struct *tty)
3652 struct gsm_mux *gsm = tty->disc_data;
3660 gsmld_detach_gsm(tty, gsm);
3662 gsmld_flush_buffer(tty);
3669 * @tty: terminal to open
3677 static int gsmld_open(struct tty_struct *tty)
3684 if (tty->ops->write == NULL)
3692 tty->disc_data = gsm;
3693 tty->receive_room = 65536;
3696 gsmld_attach_gsm(tty, gsm);
3711 * @tty: tty device
3718 static void gsmld_write_wakeup(struct tty_struct *tty)
3720 struct gsm_mux *gsm = tty->disc_data;
3727 * gsmld_read - read function for tty
3728 * @tty: tty device
3743 static ssize_t gsmld_read(struct tty_struct *tty, struct file *file, u8 *buf,
3750 * gsmld_write - write function for tty
3751 * @tty: tty device
3763 static ssize_t gsmld_write(struct tty_struct *tty, struct file *file,
3766 struct gsm_mux *gsm = tty->disc_data;
3776 space = tty_write_room(tty);
3778 ret = tty->ops->write(tty, buf, nr);
3780 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
3788 * @tty: terminal device
3800 static __poll_t gsmld_poll(struct tty_struct *tty, struct file *file,
3804 struct gsm_mux *gsm = tty->disc_data;
3806 poll_wait(file, &tty->read_wait, wait);
3807 poll_wait(file, &tty->write_wait, wait);
3813 if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
3815 if (!tty_is_writelocked(tty) && tty_write_room(tty) > 0)
3820 static int gsmld_ioctl(struct tty_struct *tty, unsigned int cmd,
3826 struct gsm_mux *gsm = tty->disc_data;
3882 return n_tty_ioctl_helper(tty, cmd, arg);
4040 /* Already in a non tty mode */
4086 /* Line discipline for real tty */
4103 * Virtual tty side
4249 static int gsmtty_install(struct tty_driver *driver, struct tty_struct *tty)
4253 unsigned int line = tty->index;
4288 ret = tty_port_install(&dlci->port, driver, tty);
4299 tty->driver_data = dlci;
4305 static int gsmtty_open(struct tty_struct *tty, struct file *filp)
4307 struct gsm_dlci *dlci = tty->driver_data;
4311 tty_port_tty_set(port, tty);
4328 return tty_port_block_til_ready(port, tty, filp);
4331 static void gsmtty_close(struct tty_struct *tty, struct file *filp)
4333 struct gsm_dlci *dlci = tty->driver_data;
4342 if (tty_port_close_start(&dlci->port, tty, filp) == 0)
4345 if (tty_port_initialized(&dlci->port) && C_HUPCL(tty))
4347 tty_port_close_end(&dlci->port, tty);
4352 static void gsmtty_hangup(struct tty_struct *tty)
4354 struct gsm_dlci *dlci = tty->driver_data;
4361 static ssize_t gsmtty_write(struct tty_struct *tty, const u8 *buf, size_t len)
4364 struct gsm_dlci *dlci = tty->driver_data;
4374 static unsigned int gsmtty_write_room(struct tty_struct *tty)
4376 struct gsm_dlci *dlci = tty->driver_data;
4382 static unsigned int gsmtty_chars_in_buffer(struct tty_struct *tty)
4384 struct gsm_dlci *dlci = tty->driver_data;
4390 static void gsmtty_flush_buffer(struct tty_struct *tty)
4392 struct gsm_dlci *dlci = tty->driver_data;
4407 static void gsmtty_wait_until_sent(struct tty_struct *tty, int timeout)
4414 static int gsmtty_tiocmget(struct tty_struct *tty)
4416 struct gsm_dlci *dlci = tty->driver_data;
4422 static int gsmtty_tiocmset(struct tty_struct *tty,
4425 struct gsm_dlci *dlci = tty->driver_data;
4441 static int gsmtty_ioctl(struct tty_struct *tty,
4444 struct gsm_dlci *dlci = tty->driver_data;
4494 static void gsmtty_set_termios(struct tty_struct *tty,
4497 struct gsm_dlci *dlci = tty->driver_data;
4505 tty_termios_copy_hw(&tty->termios, old);
4508 static void gsmtty_throttle(struct tty_struct *tty)
4510 struct gsm_dlci *dlci = tty->driver_data;
4513 if (C_CRTSCTS(tty))
4520 static void gsmtty_unthrottle(struct tty_struct *tty)
4522 struct gsm_dlci *dlci = tty->driver_data;
4525 if (C_CRTSCTS(tty))
4532 static int gsmtty_break_ctl(struct tty_struct *tty, int state)
4534 struct gsm_dlci *dlci = tty->driver_data;
4550 static void gsmtty_cleanup(struct tty_struct *tty)
4552 struct gsm_dlci *dlci = tty->driver_data;
4596 pr_err("gsm_init: tty allocation failed.\n");
4612 pr_err("gsm_init: tty registration failed.\n");