[PATCH] staging: speakup: refactor synths array to use a list

Gregory Nowak greg at gregn.net
Sun Oct 21 18:03:20 EDT 2018


On Sun, Oct 21, 2018 at 10:50:30PM +0200, Samuel Thibault wrote:
> Ah, the changes were based on 4.15 indeed, here is a version rebased on
> 4.18

Hmmm, the top line of the attached patch still says: "Index:
linux-4.15/drivers/staging/speakup/speakup_soft.c"

Greg


> 
> Samuel

> Index: linux-4.15/drivers/staging/speakup/speakup_soft.c
> ===================================================================
> --- linux-4.15.orig/drivers/staging/speakup/speakup_soft.c
> +++ linux-4.15/drivers/staging/speakup/speakup_soft.c
> @@ -214,12 +214,15 @@ static ssize_t softsynthx_read(struct fi
>  	DEFINE_WAIT(wait);
>  
>  	spin_lock_irqsave(&speakup_info.spinlock, flags);
> +	synth_soft.alive = 1;
>  	while (1) {
>  		prepare_to_wait(&speakup_event, &wait, TASK_INTERRUPTIBLE);
> -		if (!unicode)
> -			synth_buffer_skip_nonlatin1();
> -		if (!synth_buffer_empty() || speakup_info.flushing)
> -			break;
> +		if (synth_current() == &synth_soft) {
> +			if (!unicode)
> +				synth_buffer_skip_nonlatin1();
> +			if (!synth_buffer_empty() || speakup_info.flushing)
> +				break;
> +		}
>  		spin_unlock_irqrestore(&speakup_info.spinlock, flags);
>  		if (fp->f_flags & O_NONBLOCK) {
>  			finish_wait(&speakup_event, &wait);
> @@ -239,6 +242,8 @@ static ssize_t softsynthx_read(struct fi
>  
>  	/* Keep 3 bytes available for a 16bit UTF-8-encoded character */
>  	while (chars_sent <= count - bytes_per_ch) {
> +		if (synth_current() != &synth_soft)
> +			break;
>  		if (speakup_info.flushing) {
>  			speakup_info.flushing = 0;
>  			ch = '\x18';
> @@ -335,7 +340,8 @@ static unsigned int softsynth_poll(struc
>  	poll_wait(fp, &speakup_event, wait);
>  
>  	spin_lock_irqsave(&speakup_info.spinlock, flags);
> -	if (!synth_buffer_empty() || speakup_info.flushing)
> +	if (synth_current() == &synth_soft &&
> +	    (!synth_buffer_empty() || speakup_info.flushing))
>  		ret = EPOLLIN | EPOLLRDNORM;
>  	spin_unlock_irqrestore(&speakup_info.spinlock, flags);
>  	return ret;
> Index: linux-4.15/drivers/staging/speakup/spk_priv.h
> ===================================================================
> --- linux-4.15.orig/drivers/staging/speakup/spk_priv.h
> +++ linux-4.15/drivers/staging/speakup/spk_priv.h
> @@ -81,6 +81,7 @@ int synth_request_region(unsigned long s
>  int synth_release_region(unsigned long start, unsigned long n);
>  int synth_add(struct spk_synth *in_synth);
>  void synth_remove(struct spk_synth *in_synth);
> +struct spk_synth *synth_current(void);
>  
>  extern struct speakup_info_t speakup_info;
>  
> Index: linux-4.15/drivers/staging/speakup/synth.c
> ===================================================================
> --- linux-4.15.orig/drivers/staging/speakup/synth.c
> +++ linux-4.15/drivers/staging/speakup/synth.c
> @@ -495,4 +495,10 @@ void synth_remove(struct spk_synth *in_s
>  }
>  EXPORT_SYMBOL_GPL(synth_remove);
>  
> +struct spk_synth *synth_current(void)
> +{
> +	return synth;
> +}
> +EXPORT_SYMBOL_GPL(synth_current);
> +
>  short spk_punc_masks[] = { 0, SOME, MOST, PUNC, PUNC | B_SYM };

> _______________________________________________
> Speakup mailing list
> Speakup at linux-speakup.org
> http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup


-- 
web site: http://www.gregn.net
gpg public key: http://www.gregn.net/pubkey.asc
skype: gregn1
(authorization required, add me to your contacts list first)
If we haven't been in touch before, e-mail me before adding me to your contacts.

--
Free domains: http://www.eu.org/ or mail dns-manager at EU.org


More information about the Speakup mailing list