Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

speakup: Fix wait_for_xmitr for ttyio case

This was missed while introducing the tty-based serial access.

The only remaining use of wait_for_xmitr with tty-based access is in
spk_synth_is_alive_restart to check whether the synth can be restarted.
With tty-based this is up to the tty layer to cope with the buffering
etc. so we can just say yes.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Link: https://lore.kernel.org/r/20200804160637.x3iycau5izywbgzl@function
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Samuel Thibault and committed by
Greg Kroah-Hartman
2b86d9b8 9123e3a7

+14 -5
+5 -3
drivers/accessibility/speakup/serialio.c
··· 32 32 static unsigned char spk_serial_in(void); 33 33 static unsigned char spk_serial_in_nowait(void); 34 34 static void spk_serial_flush_buffer(void); 35 + static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth); 35 36 36 37 struct spk_io_ops spk_serial_io_ops = { 37 38 .synth_out = spk_serial_out, ··· 41 40 .synth_in = spk_serial_in, 42 41 .synth_in_nowait = spk_serial_in_nowait, 43 42 .flush_buffer = spk_serial_flush_buffer, 43 + .wait_for_xmitr = spk_serial_wait_for_xmitr, 44 44 }; 45 45 EXPORT_SYMBOL_GPL(spk_serial_io_ops); 46 46 ··· 213 211 } 214 212 EXPORT_SYMBOL_GPL(spk_stop_serial_interrupt); 215 213 216 - int spk_wait_for_xmitr(struct spk_synth *in_synth) 214 + static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth) 217 215 { 218 216 int tmout = SPK_XMITR_TIMEOUT; 219 217 ··· 282 280 283 281 static int spk_serial_out(struct spk_synth *in_synth, const char ch) 284 282 { 285 - if (in_synth->alive && spk_wait_for_xmitr(in_synth)) { 283 + if (in_synth->alive && spk_serial_wait_for_xmitr(in_synth)) { 286 284 outb_p(ch, speakup_info.port_tts); 287 285 return 1; 288 286 } ··· 297 295 while ((ch = *buff)) { 298 296 if (ch == '\n') 299 297 ch = synth->procspeech; 300 - if (spk_wait_for_xmitr(synth)) 298 + if (spk_serial_wait_for_xmitr(synth)) 301 299 outb(ch, speakup_info.port_tts); 302 300 else 303 301 return buff;
-1
drivers/accessibility/speakup/spk_priv.h
··· 34 34 35 35 const struct old_serial_port *spk_serial_init(int index); 36 36 void spk_stop_serial_interrupt(void); 37 - int spk_wait_for_xmitr(struct spk_synth *in_synth); 38 37 void spk_serial_release(void); 39 38 void spk_ttyio_release(void); 40 39 void spk_ttyio_register_ldisc(void);
+7
drivers/accessibility/speakup/spk_ttyio.c
··· 116 116 static unsigned char spk_ttyio_in(void); 117 117 static unsigned char spk_ttyio_in_nowait(void); 118 118 static void spk_ttyio_flush_buffer(void); 119 + static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth); 119 120 120 121 struct spk_io_ops spk_ttyio_ops = { 121 122 .synth_out = spk_ttyio_out, ··· 126 125 .synth_in = spk_ttyio_in, 127 126 .synth_in_nowait = spk_ttyio_in_nowait, 128 127 .flush_buffer = spk_ttyio_flush_buffer, 128 + .wait_for_xmitr = spk_ttyio_wait_for_xmitr, 129 129 }; 130 130 EXPORT_SYMBOL_GPL(spk_ttyio_ops); 131 131 ··· 286 284 if (speakup_tty->ops->tiocmset) 287 285 speakup_tty->ops->tiocmset(speakup_tty, set, clear); 288 286 mutex_unlock(&speakup_tty_mutex); 287 + } 288 + 289 + static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth) 290 + { 291 + return 1; 289 292 } 290 293 291 294 static unsigned char ttyio_in(int timeout)
+1
drivers/accessibility/speakup/spk_types.h
··· 158 158 unsigned char (*synth_in)(void); 159 159 unsigned char (*synth_in_nowait)(void); 160 160 void (*flush_buffer)(void); 161 + int (*wait_for_xmitr)(struct spk_synth *synth); 161 162 }; 162 163 163 164 struct spk_synth {
+1 -1
drivers/accessibility/speakup/synth.c
··· 159 159 { 160 160 if (synth->alive) 161 161 return 1; 162 - if (spk_wait_for_xmitr(synth) > 0) { 162 + if (synth->io_ops->wait_for_xmitr(synth) > 0) { 163 163 /* restart */ 164 164 synth->alive = 1; 165 165 synth_printf("%s", synth->init);