Skip to content

Commit

Permalink
speakup: Fix wait_for_xmitr for ttyio case
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Samuel Thibault authored and Greg Kroah-Hartman committed Aug 18, 2020
1 parent 9123e3a commit 2b86d9b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
8 changes: 5 additions & 3 deletions drivers/accessibility/speakup/serialio.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ static void spk_serial_tiocmset(unsigned int set, unsigned int clear);
static unsigned char spk_serial_in(void);
static unsigned char spk_serial_in_nowait(void);
static void spk_serial_flush_buffer(void);
static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth);

struct spk_io_ops spk_serial_io_ops = {
.synth_out = spk_serial_out,
Expand All @@ -40,6 +41,7 @@ struct spk_io_ops spk_serial_io_ops = {
.synth_in = spk_serial_in,
.synth_in_nowait = spk_serial_in_nowait,
.flush_buffer = spk_serial_flush_buffer,
.wait_for_xmitr = spk_serial_wait_for_xmitr,
};
EXPORT_SYMBOL_GPL(spk_serial_io_ops);

Expand Down Expand Up @@ -211,7 +213,7 @@ void spk_stop_serial_interrupt(void)
}
EXPORT_SYMBOL_GPL(spk_stop_serial_interrupt);

int spk_wait_for_xmitr(struct spk_synth *in_synth)
static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth)
{
int tmout = SPK_XMITR_TIMEOUT;

Expand Down Expand Up @@ -280,7 +282,7 @@ static void spk_serial_flush_buffer(void)

static int spk_serial_out(struct spk_synth *in_synth, const char ch)
{
if (in_synth->alive && spk_wait_for_xmitr(in_synth)) {
if (in_synth->alive && spk_serial_wait_for_xmitr(in_synth)) {
outb_p(ch, speakup_info.port_tts);
return 1;
}
Expand All @@ -295,7 +297,7 @@ const char *spk_serial_synth_immediate(struct spk_synth *synth,
while ((ch = *buff)) {
if (ch == '\n')
ch = synth->procspeech;
if (spk_wait_for_xmitr(synth))
if (spk_serial_wait_for_xmitr(synth))
outb(ch, speakup_info.port_tts);
else
return buff;
Expand Down
1 change: 0 additions & 1 deletion drivers/accessibility/speakup/spk_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

const struct old_serial_port *spk_serial_init(int index);
void spk_stop_serial_interrupt(void);
int spk_wait_for_xmitr(struct spk_synth *in_synth);
void spk_serial_release(void);
void spk_ttyio_release(void);
void spk_ttyio_register_ldisc(void);
Expand Down
7 changes: 7 additions & 0 deletions drivers/accessibility/speakup/spk_ttyio.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear);
static unsigned char spk_ttyio_in(void);
static unsigned char spk_ttyio_in_nowait(void);
static void spk_ttyio_flush_buffer(void);
static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth);

struct spk_io_ops spk_ttyio_ops = {
.synth_out = spk_ttyio_out,
Expand All @@ -125,6 +126,7 @@ struct spk_io_ops spk_ttyio_ops = {
.synth_in = spk_ttyio_in,
.synth_in_nowait = spk_ttyio_in_nowait,
.flush_buffer = spk_ttyio_flush_buffer,
.wait_for_xmitr = spk_ttyio_wait_for_xmitr,
};
EXPORT_SYMBOL_GPL(spk_ttyio_ops);

Expand Down Expand Up @@ -286,6 +288,11 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)
mutex_unlock(&speakup_tty_mutex);
}

static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth)
{
return 1;
}

static unsigned char ttyio_in(int timeout)
{
struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data;
Expand Down
1 change: 1 addition & 0 deletions drivers/accessibility/speakup/spk_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ struct spk_io_ops {
unsigned char (*synth_in)(void);
unsigned char (*synth_in_nowait)(void);
void (*flush_buffer)(void);
int (*wait_for_xmitr)(struct spk_synth *synth);
};

struct spk_synth {
Expand Down
2 changes: 1 addition & 1 deletion drivers/accessibility/speakup/synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ int spk_synth_is_alive_restart(struct spk_synth *synth)
{
if (synth->alive)
return 1;
if (spk_wait_for_xmitr(synth) > 0) {
if (synth->io_ops->wait_for_xmitr(synth) > 0) {
/* restart */
synth->alive = 1;
synth_printf("%s", synth->init);
Expand Down

0 comments on commit 2b86d9b

Please sign in to comment.