Discussion:
[PATCH 0/3]: staging: speakup: refactor to make room for serial comms changes
Okash Khawaja
2016-11-19 15:43:28 UTC
Permalink
Hi,

Following set of patches introduces serial_out() method which will point to
spk_serial_out() for other drivers and spk_serial_out2() for speakup_dummy.
Intention is to allow changing implementation of serial_out() for
speakup_dummy while allowing other drivers to continue unaffected.

Thanks,
Okash
Okash Khawaja
2016-11-19 15:46:04 UTC
Permalink
This does two things:

1. add serial_out() method to spk_synth
2. replace calls to spk_serial_out() in spk_do_catch_up() and
spk_synth_flush() with calls to serial_out()

spk_do_catch_up() and spk_synth_flush() are the only functions through
which speakup_dummy calls into spk_serial_out(). Calls to spk_serial_out() in
other drivers can stay for now.

Signed-off-by: Okash Khawaja <***@gmail.com>
---
drivers/staging/speakup/spk_types.h | 1 +
drivers/staging/speakup/synth.c | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/speakup/spk_types.h b/drivers/staging/speakup/spk_types.h
index e8ff5d7..56dc7df 100644
--- a/drivers/staging/speakup/spk_types.h
+++ b/drivers/staging/speakup/spk_types.h
@@ -168,6 +168,7 @@ struct spk_synth {
int *default_vol;
int (*probe)(struct spk_synth *synth);
void (*release)(void);
+ int (*serial_out)(const char ch);
const char *(*synth_immediate)(struct spk_synth *synth,
const char *buff);
void (*catch_up)(struct spk_synth *synth);
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 4f462c3..cef6591 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -118,7 +118,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(ch)) {
+ if (!synth->serial_out(ch)) {
schedule_timeout(msecs_to_jiffies(full_time_val));
continue;
}
@@ -128,7 +128,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->procspeech))
+ if (synth->serial_out(synth->procspeech))
schedule_timeout(
msecs_to_jiffies(delay_time_val));
else
@@ -141,7 +141,7 @@ void spk_do_catch_up(struct spk_synth *synth)
synth_buffer_getc();
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
}
- spk_serial_out(synth->procspeech);
+ synth->serial_out(synth->procspeech);
}
EXPORT_SYMBOL_GPL(spk_do_catch_up);

@@ -164,7 +164,7 @@ EXPORT_SYMBOL_GPL(spk_synth_immediate);

void spk_synth_flush(struct spk_synth *synth)
{
- spk_serial_out(synth->clear);
+ synth->serial_out(synth->clear);
}
EXPORT_SYMBOL_GPL(spk_synth_flush);

--
2.10.2
Okash Khawaja
2016-11-19 15:48:34 UTC
Permalink
spk_serial_out2() simply delegates to spk_serial_out() for now.

Signed-off-by: Okash Khawaja <***@gmail.com>
---
drivers/staging/speakup/serialio.c | 6 ++++++
drivers/staging/speakup/spk_priv.h | 1 +
2 files changed, 7 insertions(+)

diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c
index c2c435c..77592ef 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -217,6 +217,12 @@ int spk_serial_out(const char ch)
}
EXPORT_SYMBOL_GPL(spk_serial_out);

+int spk_serial_out2(const char ch)
+{
+ return spk_serial_out(ch);
+}
+EXPORT_SYMBOL_GPL(spk_serial_out2);
+
void spk_serial_release(void)
{
if (speakup_info.port_tts == 0)
diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h
index 98c4b6f..84480f3 100644
--- a/drivers/staging/speakup/spk_priv.h
+++ b/drivers/staging/speakup/spk_priv.h
@@ -46,6 +46,7 @@ int spk_wait_for_xmitr(void);
unsigned char spk_serial_in(void);
unsigned char spk_serial_in_nowait(void);
int spk_serial_out(const char ch);
+int spk_serial_out2(const char ch);
void spk_serial_release(void);

char synth_buffer_getc(void);
--
2.10.2
Okash Khawaja
2016-11-19 15:51:14 UTC
Permalink
Initialise serial_out() to spk_serial_out() in all drivers except
speakup_dummy which uses spk_serial_out2() instead.

Signed-off-by: Okash Khawaja <***@gmail.com>
---
drivers/staging/speakup/speakup_acntpc.c | 1 +
drivers/staging/speakup/speakup_acntsa.c | 1 +
drivers/staging/speakup/speakup_apollo.c | 1 +
drivers/staging/speakup/speakup_audptr.c | 1 +
drivers/staging/speakup/speakup_bns.c | 1 +
drivers/staging/speakup/speakup_decext.c | 1 +
drivers/staging/speakup/speakup_decpc.c | 1 +
drivers/staging/speakup/speakup_dectlk.c | 1 +
drivers/staging/speakup/speakup_dtlk.c | 1 +
drivers/staging/speakup/speakup_dummy.c | 1 +
drivers/staging/speakup/speakup_keypc.c | 1 +
drivers/staging/speakup/speakup_ltlk.c | 1 +
drivers/staging/speakup/speakup_soft.c | 1 +
drivers/staging/speakup/speakup_spkout.c | 1 +
drivers/staging/speakup/speakup_txprt.c | 1 +
15 files changed, 15 insertions(+)

diff --git a/drivers/staging/speakup/speakup_acntpc.c b/drivers/staging/speakup/speakup_acntpc.c
index efb791b..22557e4 100644
--- a/drivers/staging/speakup/speakup_acntpc.c
+++ b/drivers/staging/speakup/speakup_acntpc.c
@@ -115,6 +115,7 @@ static struct spk_synth synth_acntpc = {
.vars = vars,
.probe = synth_probe,
.release = accent_release,
+ .serial_out = spk_serial_out,
.synth_immediate = synth_immediate,
.catch_up = do_catch_up,
.flush = synth_flush,
diff --git a/drivers/staging/speakup/speakup_acntsa.c b/drivers/staging/speakup/speakup_acntsa.c
index 34f45d3..3b18cb9 100644
--- a/drivers/staging/speakup/speakup_acntsa.c
+++ b/drivers/staging/speakup/speakup_acntsa.c
@@ -101,6 +101,7 @@ static struct spk_synth synth_acntsa = {
.vars = vars,
.probe = synth_probe,
.release = spk_serial_release,
+ .serial_out = spk_serial_out,
.synth_immediate = spk_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = spk_synth_flush,
diff --git a/drivers/staging/speakup/speakup_apollo.c b/drivers/staging/speakup/speakup_apollo.c
index 3cbc8a7..47db548 100644
--- a/drivers/staging/speakup/speakup_apollo.c
+++ b/drivers/staging/speakup/speakup_apollo.c
@@ -110,6 +110,7 @@ static struct spk_synth synth_apollo = {
.vars = vars,
.probe = spk_serial_synth_probe,
.release = spk_serial_release,
+ .serial_out = spk_serial_out,
.synth_immediate = spk_synth_immediate,
.catch_up = do_catch_up,
.flush = spk_synth_flush,
diff --git a/drivers/staging/speakup/speakup_audptr.c b/drivers/staging/speakup/speakup_audptr.c
index 7a12b84..1714b7d 100644
--- a/drivers/staging/speakup/speakup_audptr.c
+++ b/drivers/staging/speakup/speakup_audptr.c
@@ -106,6 +106,7 @@ static struct spk_synth synth_audptr = {
.vars = vars,
.probe = synth_probe,
.release = spk_serial_release,
+ .serial_out = spk_serial_out,
.synth_immediate = spk_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = synth_flush,
diff --git a/drivers/staging/speakup/speakup_bns.c b/drivers/staging/speakup/speakup_bns.c
index 570f0c2..e9cbcfc 100644
--- a/drivers/staging/speakup/speakup_bns.c
+++ b/drivers/staging/speakup/speakup_bns.c
@@ -98,6 +98,7 @@ static struct spk_synth synth_bns = {
.vars = vars,
.probe = spk_serial_synth_probe,
.release = spk_serial_release,
+ .serial_out = spk_serial_out,
.synth_immediate = spk_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = spk_synth_flush,
diff --git a/drivers/staging/speakup/speakup_decext.c b/drivers/staging/speakup/speakup_decext.c
index 1a5cf3d..098d079 100644
--- a/drivers/staging/speakup/speakup_decext.c
+++ b/drivers/staging/speakup/speakup_decext.c
@@ -129,6 +129,7 @@ static struct spk_synth synth_decext = {
.vars = vars,
.probe = spk_serial_synth_probe,
.release = spk_serial_release,
+ .serial_out = spk_serial_out,
.synth_immediate = spk_synth_immediate,
.catch_up = do_catch_up,
.flush = synth_flush,
diff --git a/drivers/staging/speakup/speakup_decpc.c b/drivers/staging/speakup/speakup_decpc.c
index d6479bd..7fc956a 100644
--- a/drivers/staging/speakup/speakup_decpc.c
+++ b/drivers/staging/speakup/speakup_decpc.c
@@ -222,6 +222,7 @@ static struct spk_synth synth_dec_pc = {
.vars = vars,
.probe = synth_probe,
.release = dtpc_release,
+ .serial_out = spk_serial_out,
.synth_immediate = synth_immediate,
.catch_up = do_catch_up,
.flush = synth_flush,
diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c
index 7646567..9bdf2ea 100644
--- a/drivers/staging/speakup/speakup_dectlk.c
+++ b/drivers/staging/speakup/speakup_dectlk.c
@@ -132,6 +132,7 @@ static struct spk_synth synth_dectlk = {
.default_vol = g5_defaults,
.probe = spk_serial_synth_probe,
.release = spk_serial_release,
+ .serial_out = spk_serial_out,
.synth_immediate = spk_synth_immediate,
.catch_up = do_catch_up,
.flush = synth_flush,
diff --git a/drivers/staging/speakup/speakup_dtlk.c b/drivers/staging/speakup/speakup_dtlk.c
index 38aa401..47768cd 100644
--- a/drivers/staging/speakup/speakup_dtlk.c
+++ b/drivers/staging/speakup/speakup_dtlk.c
@@ -130,6 +130,7 @@ static struct spk_synth synth_dtlk = {
.vars = vars,
.probe = synth_probe,
.release = dtlk_release,
+ .serial_out = spk_serial_out,
.synth_immediate = synth_immediate,
.catch_up = do_catch_up,
.flush = synth_flush,
diff --git a/drivers/staging/speakup/speakup_dummy.c b/drivers/staging/speakup/speakup_dummy.c
index 87d2a80..65e938f 100644
--- a/drivers/staging/speakup/speakup_dummy.c
+++ b/drivers/staging/speakup/speakup_dummy.c
@@ -100,6 +100,7 @@ static struct spk_synth synth_dummy = {
.vars = vars,
.probe = spk_serial_synth_probe,
.release = spk_serial_release,
+ .serial_out = spk_serial_out2,
.synth_immediate = spk_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = spk_synth_flush,
diff --git a/drivers/staging/speakup/speakup_keypc.c b/drivers/staging/speakup/speakup_keypc.c
index 5e2170b..e7c5c1c 100644
--- a/drivers/staging/speakup/speakup_keypc.c
+++ b/drivers/staging/speakup/speakup_keypc.c
@@ -107,6 +107,7 @@ static struct spk_synth synth_keypc = {
.vars = vars,
.probe = synth_probe,
.release = keynote_release,
+ .serial_out = spk_serial_out,
.synth_immediate = synth_immediate,
.catch_up = do_catch_up,
.flush = synth_flush,
diff --git a/drivers/staging/speakup/speakup_ltlk.c b/drivers/staging/speakup/speakup_ltlk.c
index b474e8b..82a995c 100644
--- a/drivers/staging/speakup/speakup_ltlk.c
+++ b/drivers/staging/speakup/speakup_ltlk.c
@@ -113,6 +113,7 @@ static struct spk_synth synth_ltlk = {
.vars = vars,
.probe = synth_probe,
.release = spk_serial_release,
+ .serial_out = spk_serial_out,
.synth_immediate = spk_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = spk_synth_flush,
diff --git a/drivers/staging/speakup/speakup_soft.c b/drivers/staging/speakup/speakup_soft.c
index 6b1d0f5..f364ac1 100644
--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -133,6 +133,7 @@ static struct spk_synth synth_soft = {
.vars = vars,
.probe = softsynth_probe,
.release = softsynth_release,
+ .serial_out = NULL,
.synth_immediate = NULL,
.catch_up = NULL,
.flush = NULL,
diff --git a/drivers/staging/speakup/speakup_spkout.c b/drivers/staging/speakup/speakup_spkout.c
index e449f27..90384dd 100644
--- a/drivers/staging/speakup/speakup_spkout.c
+++ b/drivers/staging/speakup/speakup_spkout.c
@@ -105,6 +105,7 @@ static struct spk_synth synth_spkout = {
.vars = vars,
.probe = spk_serial_synth_probe,
.release = spk_serial_release,
+ .serial_out = spk_serial_out,
.synth_immediate = spk_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = synth_flush,
diff --git a/drivers/staging/speakup/speakup_txprt.c b/drivers/staging/speakup/speakup_txprt.c
index fd98d4f..2c322f7 100644
--- a/drivers/staging/speakup/speakup_txprt.c
+++ b/drivers/staging/speakup/speakup_txprt.c
@@ -98,6 +98,7 @@ static struct spk_synth synth_txprt = {
.vars = vars,
.probe = spk_serial_synth_probe,
.release = spk_serial_release,
+ .serial_out = spk_serial_out,
.synth_immediate = spk_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = spk_synth_flush,
--
2.10.2
Samuel Thibault
2016-11-19 22:03:59 UTC
Permalink
Hello,
Post by Okash Khawaja
Intention is to allow changing implementation of serial_out() for
speakup_dummy while allowing other drivers to continue unaffected.
Why is that needed? Why not post the whole series that implements what
you wish to have happen here?
Just to explain: the rest of the series has not been implemented yet.

Samuel

Loading...