Lines Matching full:tty

15  * This module implements the tty line discipline N_HDLC for use with
16 * tty device drivers that support bit-synchronous HDLC communications.
20 * 1. tty write calls represent one complete transmit frame of data
33 * the tty flip buffer and call the line discipline receive
39 * tty read calls.
41 * 3. tty read calls returns an entire frame of data or nothing.
45 * of the tty flags
52 * These conventions allow the standard tty programming interface
92 #include <linux/tty.h>
94 #include <linux/string.h> /* used in new tty drivers */
95 #include <linux/signal.h> /* used in new tty drivers */
100 #include "tty.h"
131 * @tty_for_write_work: pointer to tty instance used by the @write_work
161 static void flush_rx_queue(struct tty_struct *tty) in flush_rx_queue() argument
163 struct n_hdlc *n_hdlc = tty->disc_data; in flush_rx_queue()
170 static void flush_tx_queue(struct tty_struct *tty) in flush_tx_queue() argument
172 struct n_hdlc *n_hdlc = tty->disc_data; in flush_tx_queue()
191 * @tty: pointer to tty info structure
194 * else, the tty is closed, or the tty detects a hangup.
196 static void n_hdlc_tty_close(struct tty_struct *tty) in n_hdlc_tty_close() argument
198 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_close()
201 clear_bit(TTY_NO_WRITE_SPLIT, &tty->flags); in n_hdlc_tty_close()
203 tty->disc_data = NULL; in n_hdlc_tty_close()
206 wake_up_interruptible(&tty->read_wait); in n_hdlc_tty_close()
207 wake_up_interruptible(&tty->write_wait); in n_hdlc_tty_close()
220 * @tty: pointer to tty info structure
224 static int n_hdlc_tty_open(struct tty_struct *tty) in n_hdlc_tty_open() argument
226 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_open()
228 pr_debug("%s() called (device=%s)\n", __func__, tty->name); in n_hdlc_tty_open()
232 pr_err("%s: tty already associated!\n", __func__); in n_hdlc_tty_open()
243 n_hdlc->tty_for_write_work = tty; in n_hdlc_tty_open()
244 tty->disc_data = n_hdlc; in n_hdlc_tty_open()
245 tty->receive_room = 65536; in n_hdlc_tty_open()
248 set_bit(TTY_NO_WRITE_SPLIT, &tty->flags); in n_hdlc_tty_open()
251 tty_driver_flush_buffer(tty); in n_hdlc_tty_open()
260 * @tty: pointer to tty instance data
264 * list and by the tty wakeup callback.
266 static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) in n_hdlc_send_frames() argument
286 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_send_frames()
287 actual = tty->ops->write(tty, tbuf->buf, tbuf->count); in n_hdlc_send_frames()
306 wake_up_interruptible(&tty->write_wait); in n_hdlc_send_frames()
323 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); in n_hdlc_send_frames()
342 struct tty_struct *tty = n_hdlc->tty_for_write_work; in n_hdlc_tty_write_work() local
344 n_hdlc_send_frames(n_hdlc, tty); in n_hdlc_tty_write_work()
349 * @tty: pointer to associated tty instance data
353 static void n_hdlc_tty_wakeup(struct tty_struct *tty) in n_hdlc_tty_wakeup() argument
355 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_wakeup()
361 * n_hdlc_tty_receive - Called by tty driver when receive data is available
362 * @tty: pointer to tty instance data
367 * Called by tty low level driver when receive data is available. Data is
370 static void n_hdlc_tty_receive(struct tty_struct *tty, const u8 *data, in n_hdlc_tty_receive() argument
373 register struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_receive()
407 wake_up_interruptible(&tty->read_wait); in n_hdlc_tty_receive()
408 if (tty->fasync != NULL) in n_hdlc_tty_receive()
409 kill_fasync(&tty->fasync, SIGIO, POLL_IN); in n_hdlc_tty_receive()
415 * @tty: pointer to tty instance data
424 static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, in n_hdlc_tty_read() argument
428 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_read()
438 add_wait_queue(&tty->read_wait, &wait); in n_hdlc_tty_read()
441 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { in n_hdlc_tty_read()
455 if (tty_io_nonblock(tty, file)) { in n_hdlc_tty_read()
468 remove_wait_queue(&tty->read_wait, &wait); in n_hdlc_tty_read()
510 * @tty: pointer to associated tty device instance data
517 static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, in n_hdlc_tty_write() argument
520 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_write()
534 add_wait_queue(&tty->write_wait, &wait); in n_hdlc_tty_write()
543 if (tty_io_nonblock(tty, file)) { in n_hdlc_tty_write()
556 remove_wait_queue(&tty->write_wait, &wait); in n_hdlc_tty_write()
565 n_hdlc_send_frames(n_hdlc, tty); in n_hdlc_tty_write()
573 * n_hdlc_tty_ioctl - process IOCTL system call for the tty device.
574 * @tty: pointer to tty instance data
580 static int n_hdlc_tty_ioctl(struct tty_struct *tty, unsigned int cmd, in n_hdlc_tty_ioctl() argument
583 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_ioctl()
605 count = tty_chars_in_buffer(tty); in n_hdlc_tty_ioctl()
619 flush_tx_queue(tty); in n_hdlc_tty_ioctl()
624 return n_tty_ioctl_helper(tty, cmd, arg); in n_hdlc_tty_ioctl()
629 * n_hdlc_tty_poll - TTY callback for poll system call
630 * @tty: pointer to tty instance data
638 static __poll_t n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, in n_hdlc_tty_poll() argument
641 struct n_hdlc *n_hdlc = tty->disc_data; in n_hdlc_tty_poll()
648 poll_wait(filp, &tty->read_wait, wait); in n_hdlc_tty_poll()
649 poll_wait(filp, &tty->write_wait, wait); in n_hdlc_tty_poll()
654 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) in n_hdlc_tty_poll()
658 if (!tty_is_writelocked(tty) && in n_hdlc_tty_poll()