diff options
author | Okash Khawaja <okash.khawaja@gmail.com> | 2017-04-29 20:52:58 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-15 12:31:43 +0200 |
commit | ca693dcd5c02645063210e2352ff4909d9ddc7e9 (patch) | |
tree | 35d64c9b7b31a3babba861d56af0410281bd7ff3 /drivers/staging/speakup/synth.c | |
parent | staging: rtl8188eu, rtl8723bs: fix spelling mistake "Cancle" -> "Cancel" (diff) | |
download | linux-dev-ca693dcd5c02645063210e2352ff4909d9ddc7e9.tar.xz linux-dev-ca693dcd5c02645063210e2352ff4909d9ddc7e9.zip |
staging: speakup: make input functionality swappable
This moves functions which take input from external synth, into struct
spk_io_ops. The calling code then uses serial implementation of those methods
through spk_io_ops. That way we can add a parallel TTY-based implementation and
simply replace serial with TTY. That is what the next patch in this series does.
speakup_decext.c has get_last_char function which reads the most recent
available character from the synth. This patch changes that by defining
read_buff_add callback method of spk_syth and letting that update the last_char
global character read from the synth. read_buff_add is called from ISR, so
there is a possibility for last_char to be stale. Therefore it is marked as
volatile. It also pulls a repeated get_index implementation into synth.c, to
be used as a utility function.
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 '')
-rw-r--r-- | drivers/staging/speakup/synth.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c index 352e9eebc3de..9c2aa1b8b0ac 100644 --- a/drivers/staging/speakup/synth.c +++ b/drivers/staging/speakup/synth.c @@ -124,6 +124,12 @@ void spk_synth_flush(struct spk_synth *synth) } EXPORT_SYMBOL_GPL(spk_synth_flush); +unsigned char spk_synth_get_index(struct spk_synth *synth) +{ + return synth->io_ops->synth_in_nowait(); +} +EXPORT_SYMBOL_GPL(spk_synth_get_index); + int spk_synth_is_alive_nop(struct spk_synth *synth) { synth->alive = 1; @@ -249,7 +255,7 @@ void spk_reset_index_count(int sc) if (first) first = 0; else - synth->get_index(); + synth->get_index(synth); index_count = 0; sentence_count = sc; } @@ -282,7 +288,7 @@ void synth_insert_next_index(int sent_num) void spk_get_index_count(int *linecount, int *sentcount) { - int ind = synth->get_index(); + int ind = synth->get_index(synth); if (ind) { sentence_count = ind % 10; |