public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: linux-serial <linux-serial@vger.kernel.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Gilles Buloz <gilles.buloz@kontron.com>,
	Johan Hovold <johan@kernel.org>
Subject: Re: [PATCH v3 3/5] tty: Add lookahead param to receive_buf
Date: Fri, 22 Apr 2022 23:09:07 +0300 (EEST)	[thread overview]
Message-ID: <d496d544-fe59-5fa7-5d21-ab6ad025fa75@linux.intel.com> (raw)
In-Reply-To: <YmK83NfVqEvGg8DW@kroah.com>

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.


  reply	other threads:[~2022-04-22 21:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11  9:48 [PATCH v3 0/5] tty/serial: Process XON/XOFF robustly Ilpo Järvinen
2022-04-11  9:48 ` [PATCH v3 1/5] tty: Add function for handling flow control chars Ilpo Järvinen
2022-04-11  9:48 ` [PATCH v3 2/5] tty: Simplify receive flow control char logic Ilpo Järvinen
2022-04-22 14:30   ` Greg KH
2022-04-11  9:48 ` [PATCH v3 3/5] tty: Add lookahead param to receive_buf Ilpo Järvinen
2022-04-22 14:34   ` Greg KH
2022-04-22 20:09     ` Ilpo Järvinen [this message]
2022-04-26  7:48       ` Ilpo Järvinen
2022-04-26  7:59         ` Greg KH
2022-04-11  9:48 ` [PATCH v3 4/5] tty: Implement lookahead to process XON/XOFF timely Ilpo Järvinen
2022-04-11  9:48 ` [PATCH v3 5/5] tty: Use flow-control char function on closing path Ilpo Järvinen
2022-04-11 11:28   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d496d544-fe59-5fa7-5d21-ab6ad025fa75@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gilles.buloz@kontron.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox