summaryrefslogtreecommitdiffstats
path: root/drivers/staging/speakup/speakup_ltlk.c
diff options
context:
space:
mode:
authorOkash Khawaja2017-05-15 19:45:35 +0200
committerGreg Kroah-Hartman2017-05-16 14:19:41 +0200
commit6b9ad1c742bf227b1005a41d8baa315b747e3e8d (patch)
tree041dd958cc850297841057194d5f5b85232ba131 /drivers/staging/speakup/speakup_ltlk.c
parentstaging: speakup: migrate acntsa, bns, dummy and txprt to ttyio (diff)
downloadkernel-qcow2-linux-6b9ad1c742bf227b1005a41d8baa315b747e3e8d.tar.gz
kernel-qcow2-linux-6b9ad1c742bf227b1005a41d8baa315b747e3e8d.tar.xz
kernel-qcow2-linux-6b9ad1c742bf227b1005a41d8baa315b747e3e8d.zip
staging: speakup: add send_xchar, tiocmset and input functionality for tty
This patch adds further TTY-based functionality, specifically implementation of send_xchar and tiocmset methods, and input. send_xchar and tiocmset methods simply delegate to corresponding TTY operations. For input, it implements the receive_buf2 callback in tty_ldisc_ops of speakup's ldisc. If a synth defines read_buff_add method then receive_buf2 simply delegates to that and returns. For spk_ttyio_in, the data is passed from receive_buf2 thread to spk_ttyio_in thread through spk_ldisc_data structure. It has following members: - char buf: represents data received - struct semaphore sem: used to signal to spk_ttyio_in thread that data is available to be read without having to busy wait - bool buf_free: this is used in comination with mb() calls to syncronise the two threads over buf receive_buf2 only writes to buf if buf_free is true. The check for buf_free and writing to buf are separated by mb() to ensure that spk_ttyio_in has read buf before receive_buf2 writes to it. After writing, it ups the semaphore to signal to spk_ttyio_in that there is now data to read. spk_ttyio_in waits for data to read by downing the semaphore. Thus when signalled by receive_buf2 thread above, it reads from buf and sets buf_free to true. These two operations are separated by mb() to ensure that receive_buf2 thread finds buf_free to be true only after buf has been read. After that spk_ttyio_in calls tty_schedule_flip for subsequent data to come in through receive_buf2. Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/speakup/speakup_ltlk.c')
0 files changed, 0 insertions, 0 deletions