[patch 5/7] staging: speakup: make input functionality swappable

Samuel Thibault samuel.thibault at ens-lyon.org
Sun Apr 9 17:42:29 EDT 2017


Hello,

Okash Khawaja, on lun. 03 avril 2017 21:21:28 +0100, wrote:
> Index: linux-staging/drivers/staging/speakup/speakup_decext.c
> ===================================================================
> --- linux-staging.orig/drivers/staging/speakup/speakup_decext.c
> +++ linux-staging/drivers/staging/speakup/speakup_decext.c
> @@ -30,20 +30,16 @@
>  #define DRV_VERSION "2.14"
>  #define SYNTH_CLEAR 0x03
>  #define PROCSPEECH 0x0b
> -static unsigned char last_char;
> +static volatile unsigned char last_char;
>  
> -static inline u_char get_last_char(void)
> +static void read_buff_add(u_char ch)
>  {
> -	u_char avail = inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR;
> -
> -	if (avail)
> -		last_char = inb_p(speakup_info.port_tts + UART_RX);
> -	return last_char;
> +	last_char = ch;
>  }
>  
>  static inline bool synth_full(void)
>  {
> -	return get_last_char() == 0x13;
> +	return last_char == 0x13;
>  }
>  
>  static void do_catch_up(struct spk_synth *synth);
> @@ -135,7 +131,7 @@ static struct spk_synth synth_decext = {
>  	.flush = synth_flush,
>  	.is_alive = spk_synth_is_alive_restart,
>  	.synth_adjust = NULL,
> -	.read_buff_add = NULL,
> +	.read_buff_add = read_buff_add,
>  	.get_index = NULL,
>  	.indexing = {
>  		.command = NULL,

Ideally we'd have somebody test this. Perhaps write a separate mail
on speakup at linux-speakup.org with subject "decext testers wanted!" to
arrange with somebody who knows one for testing this.

> @@ -169,6 +170,11 @@ static inline bool synth_full(void)
>  	return (synth_status & TTS_ALMOST_FULL) != 0;
>  }
>  
> +static unsigned char get_index(struct spk_synth *synth)
> +{
> +	return synth->io_ops->synth_in_nowait();
> +}

This repeats several times and is already completely generic.  I would
say make this function a helper exported from synth.c, that drivers can
then just reference.

Samuel


More information about the Speakup mailing list