public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: linux-serial <linux-serial@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 7/8] n_tty: Reindent if condition
Date: Thu, 9 Mar 2023 15:59:55 +0200 (EET)	[thread overview]
Message-ID: <ec97f7c5-b9fb-aefb-2249-9bfadc7eee7d@linux.intel.com> (raw)
In-Reply-To: <b7e72552-d4ec-46f2-4f45-d8baec914ff1@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1428 bytes --]

On Thu, 9 Mar 2023, Jiri Slaby wrote:

> On 09. 03. 23, 9:20, Ilpo Järvinen wrote:
> > Align if condition to make it easier to read.
> > 
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > ---
> >   drivers/tty/n_tty.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
> > index 0481e57077f1..1c9e5d2ea7de 100644
> > --- a/drivers/tty/n_tty.c
> > +++ b/drivers/tty/n_tty.c
> > @@ -1176,7 +1176,7 @@ static void n_tty_receive_overrun(struct tty_struct
> > *tty)
> >     	ldata->num_overrun++;
> >   	if (time_after(jiffies, ldata->overrun_time + HZ) ||
> > -			time_after(ldata->overrun_time, jiffies)) {
> > +	    time_after(ldata->overrun_time, jiffies)) {
> 
> Staring at this, what the second time_after() does in the first place?
> 
> >   		tty_warn(tty, "%d input overrun(s)\n", ldata->num_overrun);
> >   		ldata->overrun_time = jiffies;
> >   		ldata->num_overrun = 0;

That's a very good question ... I first thought it was checking whether 
the jiffies is between two times but obviously that was wrong intuition 
now when taking a closer look.

But then, looking more into it, this whole thing looks an opencoded 
*_ratelimited print. So perhaps overrun_time could be removed 
completely... ? I can see it kinda changes priority of which messages 
would get filtered out but I don't know if that's a problem or not.

-- 
 i.

  reply	other threads:[~2023-03-09 14:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09  8:20 [PATCH 0/8] tty: Cleanups Ilpo Järvinen
2023-03-09  8:20 ` [PATCH 1/8] n_tty: Convert no_space_left to space_left boolean Ilpo Järvinen
2023-03-09  8:20 ` [PATCH 2/8] tty_ioctl: Use BIT() for internal flags Ilpo Järvinen
2023-03-09  8:20 ` [PATCH 3/8] Bluetooth: hci_ldisc: Fix tty_set_termios() return value assumptions Ilpo Järvinen
2023-03-14 23:10   ` patchwork-bot+bluetooth
2023-03-09  8:20 ` [PATCH 4/8] n_tty: Sort includes alphabetically Ilpo Järvinen
2023-03-09  8:20 ` [PATCH 5/8] n_tty: Use DIV_ROUND_UP() in room calculation Ilpo Järvinen
2023-03-09  8:20 ` [PATCH 6/8] n_tty: Cleanup includes Ilpo Järvinen
2023-03-09  8:20 ` [PATCH 7/8] n_tty: Reindent if condition Ilpo Järvinen
2023-03-09 13:45   ` Jiri Slaby
2023-03-09 13:59     ` Ilpo Järvinen [this message]
2023-03-09  8:20 ` [PATCH 8/8] tty: Convert hw_stopped in tty_struct to bool Ilpo Järvinen
2023-03-09  8:33   ` Arnd Bergmann
2023-03-09 14:58   ` Ulf Hansson

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=ec97f7c5-b9fb-aefb-2249-9bfadc7eee7d@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@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