[PATCH 1/3] staging: speakup: add serial_out() method to spk_synth

Okash Khawaja okash.khawaja at gmail.com
Sat Nov 19 10:46:04 EST 2016


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 <okash.khawaja at 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



More information about the Speakup mailing list