Re: [PATCH v3 3/5] tty: Add lookahead param to receive_buf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 22 Apr 2022, Greg KH wrote:

> > diff --git a/drivers/accessibility/speakup/spk_ttyio.c b/drivers/accessibility/speakup/spk_ttyio.c
> > index 08cf8a17754b..b33536eea1d3 100644
> > --- a/drivers/accessibility/speakup/spk_ttyio.c
> > +++ b/drivers/accessibility/speakup/spk_ttyio.c
> > @@ -73,7 +73,7 @@ static void spk_ttyio_ldisc_close(struct tty_struct *tty)
> >  
> >  static int spk_ttyio_receive_buf2(struct tty_struct *tty,
> >  				  const unsigned char *cp,
> > -				  const char *fp, int count)
> > +				  const char *fp, int count, unsigned int lookahead_count)
> 
> Ick, adding yet-another-parameter to a function is a mess as it's hard
> to know what to do with this and what it means just by looking at when
> it is called.

To be honest, I didn't like it either but just couldn't find another 
way... That is, not until now that you pushed.

I think I can add lookahead_count into n_tty_data, then both layers 
(n_tty and tty_buffer) that depend on it will indepedently keep track of 
it rather than passing it through the whole callchain.

> >  /* Returns true if c is consumed as flow-control character */
> > -static bool n_tty_receive_char_flow_ctrl(struct tty_struct *tty, unsigned char c)
> > +static bool n_tty_receive_char_flow_ctrl(struct tty_struct *tty, unsigned char c,
> > +					 bool lookahead_done)
> >  {
> >  	if (!n_tty_is_char_flow_ctrl(tty, c))
> >  		return false;
> >  
> > +	if (lookahead_done)
> > +		return true;
> 
> Why would this function be called if this option was true?

Agreed, it makes sense to move the check before call (and then I also 
don't need to reorganize this function anymore).

> the overall idea is good, this implementation isn't quite there yet.

Thanks for taking a look.


-- 
 i.




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux