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

staging: speakup: move those functions which do outgoing serial comms, into serialio.c

This moves spk_synth_immediate and spk_serial_synth_probe functions into
serialio.c. These functions do outgoing serial comms. The move is a step
towards collecting all serial comms in serialio.c. This also renames
spk_synth_immediate to spk_serial_synth_immediate.

Code inside those functions has not been changed. Along the way, this patch
also fixes a couple of spots which were calling spk_synth_immediate directly,
so that the calls now happen via the spk_syth struct.

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>

authored by

Okash Khawaja and committed by
Greg Kroah-Hartman
98c1fda7 5e492ab5

+61 -61
+46
drivers/staging/speakup/serialio.c
··· 136 136 outb(1, speakup_info.port_tts + UART_FCR); /* Turn FIFO On */ 137 137 } 138 138 139 + int spk_serial_synth_probe(struct spk_synth *synth) 140 + { 141 + const struct old_serial_port *ser; 142 + int failed = 0; 143 + 144 + if ((synth->ser >= SPK_LO_TTY) && (synth->ser <= SPK_HI_TTY)) { 145 + ser = spk_serial_init(synth->ser); 146 + if (!ser) { 147 + failed = -1; 148 + } else { 149 + outb_p(0, ser->port); 150 + mdelay(1); 151 + outb_p('\r', ser->port); 152 + } 153 + } else { 154 + failed = -1; 155 + pr_warn("ttyS%i is an invalid port\n", synth->ser); 156 + } 157 + if (failed) { 158 + pr_info("%s: not found\n", synth->long_name); 159 + return -ENODEV; 160 + } 161 + pr_info("%s: ttyS%i, Driver Version %s\n", 162 + synth->long_name, synth->ser, synth->version); 163 + synth->alive = 1; 164 + return 0; 165 + } 166 + EXPORT_SYMBOL_GPL(spk_serial_synth_probe); 167 + 139 168 void spk_stop_serial_interrupt(void) 140 169 { 141 170 if (speakup_info.port_tts == 0) ··· 251 222 } 252 223 return 0; 253 224 } 225 + 226 + const char *spk_serial_synth_immediate(struct spk_synth *synth, const char *buff) 227 + { 228 + u_char ch; 229 + 230 + while ((ch = *buff)) { 231 + if (ch == '\n') 232 + ch = synth->procspeech; 233 + if (spk_wait_for_xmitr(synth)) 234 + outb(ch, speakup_info.port_tts); 235 + else 236 + return buff; 237 + buff++; 238 + } 239 + return NULL; 240 + } 241 + EXPORT_SYMBOL_GPL(spk_serial_synth_immediate); 254 242 255 243 void spk_serial_release(void) 256 244 {
+2 -2
drivers/staging/speakup/speakup_acntsa.c
··· 102 102 .io_ops = &spk_serial_io_ops, 103 103 .probe = synth_probe, 104 104 .release = spk_serial_release, 105 - .synth_immediate = spk_synth_immediate, 105 + .synth_immediate = spk_serial_synth_immediate, 106 106 .catch_up = spk_do_catch_up, 107 107 .flush = spk_synth_flush, 108 108 .is_alive = spk_synth_is_alive_restart, ··· 127 127 128 128 failed = spk_serial_synth_probe(synth); 129 129 if (failed == 0) { 130 - spk_synth_immediate(synth, "\033=R\r"); 130 + synth->synth_immediate(synth, "\033=R\r"); 131 131 mdelay(100); 132 132 } 133 133 synth->alive = !failed;
+1 -1
drivers/staging/speakup/speakup_apollo.c
··· 111 111 .io_ops = &spk_serial_io_ops, 112 112 .probe = spk_serial_synth_probe, 113 113 .release = spk_serial_release, 114 - .synth_immediate = spk_synth_immediate, 114 + .synth_immediate = spk_serial_synth_immediate, 115 115 .catch_up = do_catch_up, 116 116 .flush = spk_synth_flush, 117 117 .is_alive = spk_synth_is_alive_restart,
+2 -2
drivers/staging/speakup/speakup_audptr.c
··· 107 107 .io_ops = &spk_serial_io_ops, 108 108 .probe = synth_probe, 109 109 .release = spk_serial_release, 110 - .synth_immediate = spk_synth_immediate, 110 + .synth_immediate = spk_serial_synth_immediate, 111 111 .catch_up = spk_do_catch_up, 112 112 .flush = synth_flush, 113 113 .is_alive = spk_synth_is_alive_restart, ··· 144 144 unsigned char test = 0; 145 145 char synth_id[40] = ""; 146 146 147 - spk_synth_immediate(synth, "\x05[Q]"); 147 + synth->synth_immediate(synth, "\x05[Q]"); 148 148 synth_id[test] = spk_serial_in(); 149 149 if (synth_id[test] == 'A') { 150 150 do {
+1 -1
drivers/staging/speakup/speakup_bns.c
··· 99 99 .io_ops = &spk_serial_io_ops, 100 100 .probe = spk_serial_synth_probe, 101 101 .release = spk_serial_release, 102 - .synth_immediate = spk_synth_immediate, 102 + .synth_immediate = spk_serial_synth_immediate, 103 103 .catch_up = spk_do_catch_up, 104 104 .flush = spk_synth_flush, 105 105 .is_alive = spk_synth_is_alive_restart,
+2 -2
drivers/staging/speakup/speakup_decext.c
··· 130 130 .io_ops = &spk_serial_io_ops, 131 131 .probe = spk_serial_synth_probe, 132 132 .release = spk_serial_release, 133 - .synth_immediate = spk_synth_immediate, 133 + .synth_immediate = spk_serial_synth_immediate, 134 134 .catch_up = do_catch_up, 135 135 .flush = synth_flush, 136 136 .is_alive = spk_synth_is_alive_restart, ··· 225 225 static void synth_flush(struct spk_synth *synth) 226 226 { 227 227 in_escape = 0; 228 - spk_synth_immediate(synth, "\033P;10z\033\\"); 228 + synth->synth_immediate(synth, "\033P;10z\033\\"); 229 229 } 230 230 231 231 module_param_named(ser, synth_decext.ser, int, 0444);
+1 -1
drivers/staging/speakup/speakup_dectlk.c
··· 133 133 .io_ops = &spk_serial_io_ops, 134 134 .probe = spk_serial_synth_probe, 135 135 .release = spk_serial_release, 136 - .synth_immediate = spk_synth_immediate, 136 + .synth_immediate = spk_serial_synth_immediate, 137 137 .catch_up = do_catch_up, 138 138 .flush = synth_flush, 139 139 .is_alive = spk_synth_is_alive_restart,
+1 -1
drivers/staging/speakup/speakup_dummy.c
··· 101 101 .io_ops = &spk_serial_io_ops, 102 102 .probe = spk_serial_synth_probe, 103 103 .release = spk_serial_release, 104 - .synth_immediate = spk_synth_immediate, 104 + .synth_immediate = spk_serial_synth_immediate, 105 105 .catch_up = spk_do_catch_up, 106 106 .flush = spk_synth_flush, 107 107 .is_alive = spk_synth_is_alive_restart,
+2 -2
drivers/staging/speakup/speakup_ltlk.c
··· 114 114 .io_ops = &spk_serial_io_ops, 115 115 .probe = synth_probe, 116 116 .release = spk_serial_release, 117 - .synth_immediate = spk_synth_immediate, 117 + .synth_immediate = spk_serial_synth_immediate, 118 118 .catch_up = spk_do_catch_up, 119 119 .flush = spk_synth_flush, 120 120 .is_alive = spk_synth_is_alive_restart, ··· 139 139 unsigned char *t, i; 140 140 unsigned char buf[50], rom_v[20]; 141 141 142 - spk_synth_immediate(synth, "\x18\x01?"); 142 + synth->synth_immediate(synth, "\x18\x01?"); 143 143 for (i = 0; i < 50; i++) { 144 144 buf[i] = spk_serial_in(); 145 145 if (i > 2 && buf[i] == 0x7f)
+1 -1
drivers/staging/speakup/speakup_spkout.c
··· 105 105 .io_ops = &spk_serial_io_ops, 106 106 .probe = spk_serial_synth_probe, 107 107 .release = spk_serial_release, 108 - .synth_immediate = spk_synth_immediate, 108 + .synth_immediate = spk_serial_synth_immediate, 109 109 .catch_up = spk_do_catch_up, 110 110 .flush = synth_flush, 111 111 .is_alive = spk_synth_is_alive_restart,
+1 -1
drivers/staging/speakup/speakup_txprt.c
··· 98 98 .io_ops = &spk_serial_io_ops, 99 99 .probe = spk_serial_synth_probe, 100 100 .release = spk_serial_release, 101 - .synth_immediate = spk_synth_immediate, 101 + .synth_immediate = spk_serial_synth_immediate, 102 102 .catch_up = spk_do_catch_up, 103 103 .flush = spk_synth_flush, 104 104 .is_alive = spk_synth_is_alive_restart,
+1 -1
drivers/staging/speakup/spk_priv.h
··· 58 58 const char *buf, size_t count); 59 59 60 60 int spk_serial_synth_probe(struct spk_synth *synth); 61 - const char *spk_synth_immediate(struct spk_synth *synth, const char *buff); 61 + const char *spk_serial_synth_immediate(struct spk_synth *synth, const char *buff); 62 62 void spk_do_catch_up(struct spk_synth *synth); 63 63 void spk_synth_flush(struct spk_synth *synth); 64 64 int spk_synth_is_alive_nop(struct spk_synth *synth);
-46
drivers/staging/speakup/synth.c
··· 44 44 45 45 static int do_synth_init(struct spk_synth *in_synth); 46 46 47 - int spk_serial_synth_probe(struct spk_synth *synth) 48 - { 49 - const struct old_serial_port *ser; 50 - int failed = 0; 51 - 52 - if ((synth->ser >= SPK_LO_TTY) && (synth->ser <= SPK_HI_TTY)) { 53 - ser = spk_serial_init(synth->ser); 54 - if (!ser) { 55 - failed = -1; 56 - } else { 57 - outb_p(0, ser->port); 58 - mdelay(1); 59 - outb_p('\r', ser->port); 60 - } 61 - } else { 62 - failed = -1; 63 - pr_warn("ttyS%i is an invalid port\n", synth->ser); 64 - } 65 - if (failed) { 66 - pr_info("%s: not found\n", synth->long_name); 67 - return -ENODEV; 68 - } 69 - pr_info("%s: ttyS%i, Driver Version %s\n", 70 - synth->long_name, synth->ser, synth->version); 71 - synth->alive = 1; 72 - return 0; 73 - } 74 - EXPORT_SYMBOL_GPL(spk_serial_synth_probe); 75 - 76 47 /* 77 48 * Main loop of the progression thread: keep eating from the buffer 78 49 * and push to the serial port, waiting as needed ··· 117 146 synth->io_ops->synth_out(synth, synth->procspeech); 118 147 } 119 148 EXPORT_SYMBOL_GPL(spk_do_catch_up); 120 - 121 - const char *spk_synth_immediate(struct spk_synth *synth, const char *buff) 122 - { 123 - u_char ch; 124 - 125 - while ((ch = *buff)) { 126 - if (ch == '\n') 127 - ch = synth->procspeech; 128 - if (spk_wait_for_xmitr(synth)) 129 - outb(ch, speakup_info.port_tts); 130 - else 131 - return buff; 132 - buff++; 133 - } 134 - return NULL; 135 - } 136 - EXPORT_SYMBOL_GPL(spk_synth_immediate); 137 149 138 150 void spk_synth_flush(struct spk_synth *synth) 139 151 {