Skip to content

Commit 2b86d9b

Browse files
sthibaulgregkh
authored andcommitted
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>
1 parent 9123e3a commit 2b86d9b

5 files changed

Lines changed: 14 additions & 5 deletions

File tree

‎drivers/accessibility/speakup/serialio.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static void spk_serial_tiocmset(unsigned int set, unsigned int clear);
3232
static unsigned char spk_serial_in(void);
3333
static unsigned char spk_serial_in_nowait(void);
3434
static void spk_serial_flush_buffer(void);
35+
static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth);
3536

3637
struct spk_io_ops spk_serial_io_ops = {
3738
.synth_out = spk_serial_out,
@@ -40,6 +41,7 @@ struct spk_io_ops spk_serial_io_ops = {
4041
.synth_in = spk_serial_in,
4142
.synth_in_nowait = spk_serial_in_nowait,
4243
.flush_buffer = spk_serial_flush_buffer,
44+
.wait_for_xmitr = spk_serial_wait_for_xmitr,
4345
};
4446
EXPORT_SYMBOL_GPL(spk_serial_io_ops);
4547

@@ -211,7 +213,7 @@ void spk_stop_serial_interrupt(void)
211213
}
212214
EXPORT_SYMBOL_GPL(spk_stop_serial_interrupt);
213215

214-
int spk_wait_for_xmitr(struct spk_synth *in_synth)
216+
static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth)
215217
{
216218
int tmout = SPK_XMITR_TIMEOUT;
217219

@@ -280,7 +282,7 @@ static void spk_serial_flush_buffer(void)
280282

281283
static int spk_serial_out(struct spk_synth *in_synth, const char ch)
282284
{
283-
if (in_synth->alive && spk_wait_for_xmitr(in_synth)) {
285+
if (in_synth->alive && spk_serial_wait_for_xmitr(in_synth)) {
284286
outb_p(ch, speakup_info.port_tts);
285287
return 1;
286288
}
@@ -295,7 +297,7 @@ const char *spk_serial_synth_immediate(struct spk_synth *synth,
295297
while ((ch = *buff)) {
296298
if (ch == '\n')
297299
ch = synth->procspeech;
298-
if (spk_wait_for_xmitr(synth))
300+
if (spk_serial_wait_for_xmitr(synth))
299301
outb(ch, speakup_info.port_tts);
300302
else
301303
return buff;

‎drivers/accessibility/speakup/spk_priv.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
const struct old_serial_port *spk_serial_init(int index);
3636
void spk_stop_serial_interrupt(void);
37-
int spk_wait_for_xmitr(struct spk_synth *in_synth);
3837
void spk_serial_release(void);
3938
void spk_ttyio_release(void);
4039
void spk_ttyio_register_ldisc(void);

‎drivers/accessibility/speakup/spk_ttyio.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear);
116116
static unsigned char spk_ttyio_in(void);
117117
static unsigned char spk_ttyio_in_nowait(void);
118118
static void spk_ttyio_flush_buffer(void);
119+
static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth);
119120

120121
struct spk_io_ops spk_ttyio_ops = {
121122
.synth_out = spk_ttyio_out,
@@ -125,6 +126,7 @@ struct spk_io_ops spk_ttyio_ops = {
125126
.synth_in = spk_ttyio_in,
126127
.synth_in_nowait = spk_ttyio_in_nowait,
127128
.flush_buffer = spk_ttyio_flush_buffer,
129+
.wait_for_xmitr = spk_ttyio_wait_for_xmitr,
128130
};
129131
EXPORT_SYMBOL_GPL(spk_ttyio_ops);
130132

@@ -286,6 +288,11 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)
286288
mutex_unlock(&speakup_tty_mutex);
287289
}
288290

291+
static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth)
292+
{
293+
return 1;
294+
}
295+
289296
static unsigned char ttyio_in(int timeout)
290297
{
291298
struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data;

‎drivers/accessibility/speakup/spk_types.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ struct spk_io_ops {
158158
unsigned char (*synth_in)(void);
159159
unsigned char (*synth_in_nowait)(void);
160160
void (*flush_buffer)(void);
161+
int (*wait_for_xmitr)(struct spk_synth *synth);
161162
};
162163

163164
struct spk_synth {

‎drivers/accessibility/speakup/synth.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ int spk_synth_is_alive_restart(struct spk_synth *synth)
159159
{
160160
if (synth->alive)
161161
return 1;
162-
if (spk_wait_for_xmitr(synth) > 0) {
162+
if (synth->io_ops->wait_for_xmitr(synth) > 0) {
163163
/* restart */
164164
synth->alive = 1;
165165
synth_printf("%s", synth->init);

0 commit comments

Comments
 (0)