speakup: Simplify spk_ttyio_out error handling.
This avoids most code indentation Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Link: https://lore.kernel.org/r/20210126222147.3848175-4-samuel.thibault@ens-lyon.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4f2a81f3a8
commit
117422521e
|
@ -225,14 +225,21 @@ void spk_ttyio_unregister_ldisc(void)
|
||||||
static int spk_ttyio_out(struct spk_synth *in_synth, const char ch)
|
static int spk_ttyio_out(struct spk_synth *in_synth, const char ch)
|
||||||
{
|
{
|
||||||
struct tty_struct *tty = in_synth->dev;
|
struct tty_struct *tty = in_synth->dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (in_synth->alive && tty->ops->write) {
|
if (!in_synth->alive || !tty->ops->write)
|
||||||
int ret = tty->ops->write(tty, &ch, 1);
|
return 0;
|
||||||
|
|
||||||
|
ret = tty->ops->write(tty, &ch, 1);
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
/* No room */
|
/* No room */
|
||||||
return 0;
|
return 0;
|
||||||
if (ret < 0) {
|
|
||||||
|
if (ret > 0)
|
||||||
|
/* Success */
|
||||||
|
return 1;
|
||||||
|
|
||||||
pr_warn("%s: I/O error, deactivating speakup\n",
|
pr_warn("%s: I/O error, deactivating speakup\n",
|
||||||
in_synth->long_name);
|
in_synth->long_name);
|
||||||
/* No synth any more, so nobody will restart TTYs,
|
/* No synth any more, so nobody will restart TTYs,
|
||||||
|
@ -243,11 +250,6 @@ static int spk_ttyio_out(struct spk_synth *in_synth, const char ch)
|
||||||
speakup_start_ttys();
|
speakup_start_ttys();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int spk_ttyio_out_unicode(struct spk_synth *in_synth, u16 ch)
|
static int spk_ttyio_out_unicode(struct spk_synth *in_synth, u16 ch)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue