From: Greg KH <gregkh@linuxfoundation.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
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: Tue, 26 Apr 2022 09:59:01 +0200 [thread overview]
Message-ID: <YmemRRJugxbsEhWU@kroah.com> (raw)
In-Reply-To: <769b1be-87c3-e1c1-b1f9-d56a74ff549@linux.intel.com>
On Tue, Apr 26, 2022 at 10:48:40AM +0300, Ilpo Järvinen wrote:
> On Fri, 22 Apr 2022, Ilpo Järvinen wrote:
>
> > On Fri, 22 Apr 2022, Greg KH wrote:
> >
> > > > /* 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).
>
> I think I want to renege on this. The reason is that on flow control char,
> two things must occur:
> a) it must not be treated as normal char
> b) if not yet processed, flow control actions need to be taken
>
> When the check is inside, return value of n_tty_receive_char_flow_ctrl
> decides a), and b) is kept internal to n_tty_receive_char_flow_ctrl().
>
> If I more that lookahead_done check into the caller domain, things get
> IMHO a lot more messy. Effectively, I have three options for the calling
> domain to chose from:
>
> if (I_IXON(tty)) {
> if (!lookahead_done) {
> if (n_tty_receive_char_flow_ctrl(tty, c))
> return;
> } else if (n_tty_is_char_flow_ctrl(tty, c)) {
> return;
> }
> }
>
> or
>
> if (I_IXON(tty)) {
> if ((!lookahead_done && n_tty_receive_char_flow_ctrl(tty, c)) ||
> (lookahead_done && n_tty_is_char_flow_ctrl(tty, c))) {
> return;
> }
>
> vs
>
> if (I_IXON(tty) && n_tty_receive_char_flow_ctrl(tty, c, lookahead_done))
> return;
>
> I heavily prefer that last option.
Ok, then document the heck out of it please.
greg k-h
next prev parent reply other threads:[~2022-04-26 7:59 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
2022-04-26 7:48 ` Ilpo Järvinen
2022-04-26 7:59 ` Greg KH [this message]
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=YmemRRJugxbsEhWU@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gilles.buloz@kontron.com \
--cc=ilpo.jarvinen@linux.intel.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.