diff options
author | Okash Khawaja | 2017-03-14 14:41:53 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2017-03-16 03:11:22 +0100 |
commit | 1e441594e509c35a222e397d224de17cee103740 (patch) | |
tree | 58602e5db12efb4708720b887c6255efb11f5c5c /drivers/staging/speakup/synth.c | |
parent | staging: speakup: spk_serial_out and spk_wait_for_xmitr to take synth arg (diff) | |
download | kernel-qcow2-linux-1e441594e509c35a222e397d224de17cee103740.tar.gz kernel-qcow2-linux-1e441594e509c35a222e397d224de17cee103740.tar.xz kernel-qcow2-linux-1e441594e509c35a222e397d224de17cee103740.zip |
staging: speakup: add spk_io_ops struct to spk_synth
This patch adds spk_io_ops struct which contain those methods whose job is to
communicate with synth device. Currently, all comms with external synth
device use raw serial i/o. The idea is to group all methods which do the
actual communication with external device into this new struct. Then migrating
a serial-based synth over to an alternative to raw serial i/o will mean
swapping serial spk_io_ops instance with the io_ops instance of the new
method, making the migration simpler.
At the moment, this struct only contains one method, synth_out but more will
be added in future when migrating synths which require input functionality.
Also at the moment, synth_out method has one implementation which uses
serial i/o. Plan is to add an alternative.
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/synth.c')
-rw-r--r-- | drivers/staging/speakup/synth.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c index 41967c9e5003..72d4f027e40a 100644 --- a/drivers/staging/speakup/synth.c +++ b/drivers/staging/speakup/synth.c @@ -120,7 +120,7 @@ void spk_do_catch_up(struct spk_synth *synth) spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ch == '\n') ch = synth->procspeech; - if (!spk_serial_out(synth, ch)) { + if (!synth->io_ops->synth_out(synth, ch)) { schedule_timeout(msecs_to_jiffies(full_time_val)); continue; } @@ -130,7 +130,7 @@ void spk_do_catch_up(struct spk_synth *synth) delay_time_val = delay_time->u.n.value; full_time_val = full_time->u.n.value; spin_unlock_irqrestore(&speakup_info.spinlock, flags); - if (spk_serial_out(synth, synth->procspeech)) + if (synth->io_ops->synth_out(synth, synth->procspeech)) schedule_timeout( msecs_to_jiffies(delay_time_val)); else @@ -143,7 +143,7 @@ void spk_do_catch_up(struct spk_synth *synth) synth_buffer_getc(); spin_unlock_irqrestore(&speakup_info.spinlock, flags); } - spk_serial_out(synth, synth->procspeech); + synth->io_ops->synth_out(synth, synth->procspeech); } EXPORT_SYMBOL_GPL(spk_do_catch_up); @@ -166,7 +166,7 @@ EXPORT_SYMBOL_GPL(spk_synth_immediate); void spk_synth_flush(struct spk_synth *synth) { - spk_serial_out(synth, synth->clear); + synth->io_ops->synth_out(synth, synth->clear); } EXPORT_SYMBOL_GPL(spk_synth_flush); |