Message ID | 20230309082035.14880-8-ilpo.jarvinen@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp170655wrd; Thu, 9 Mar 2023 00:34:36 -0800 (PST) X-Google-Smtp-Source: AK7set9ciA0Nqu6yvrHJSiPOZkRYT0mbxJ0gdHOzP3sA+J3cYYSO0Y26MGJx6OXDN6N8pAY2XwzK X-Received: by 2002:a05:6a21:338a:b0:cc:b73a:6f63 with SMTP id yy10-20020a056a21338a00b000ccb73a6f63mr23309036pzb.4.1678350876318; Thu, 09 Mar 2023 00:34:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350876; cv=none; d=google.com; s=arc-20160816; b=nMc2oL6bxzAOHy6Wav+n94QVOdUkyiQ4+OBAfpZVGsWsQtsHoQsW/+++qk3Gf0gM0P HOBjORmQVHCJ89TouQLuknXuYKREnHPKG3P3P7KhmPy8XW88Pde8PWWtpNL51ruJRGuZ JaIundTKfTP64FA8Cp1Dggh1VUzaD4nsG1sXq20ZyzHfQQTN/sBQZTFqGRTyDaN24xeK YiAmnE1Td5qNvTBhevvw3UKzhgKIKCcuqv6tHjri34AlwtHEvymKhLerysnhRfmbN3Nw LG6Q80VjC5q/0sm31FR3D/3zt4MCinD8vU4TNCGcnjsR7EzlWejTuvYtg9v2GaRkHi2i QF3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=L3f1DDuWrwPGfgSVjmZqamPYMNIA4nfTzIaX/N/8oL8=; b=po8yktCDvs/Q91Q0oYJZ7JI+hSxJxNA+YfadnE9/4p/6474zuTqrz0khvRf8bLlByC hMVpSoEvOuZSXStV+D2zyCgp/cqw293sGs0qjXWeJh+CraCfXAMUcZp/wP8iqzYH2FNf L4jTfPboAlmmIXcCDiDv0Ardw7r09yD1ub6vNXTbh7IolAnt/qzvx8NbB0ddIhscKifO kWI8o+tuzOcg8nb0gTOQP8RZP/ADg/45H2P6QOGr4SfBa1EqSCL2D5fiG0rZMQiVQONj 8R4qRVkpZW+Nw0+k0bsEQKHhm/hnawgI3LwmzbcYlclHnQA87STrGF2ZhF04jzq/m+LK AGBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YE7Wcahn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a63924d000000b004fbc18d0938si16304254pgn.361.2023.03.09.00.34.23; Thu, 09 Mar 2023 00:34:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YE7Wcahn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229685AbjCIIXe (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Thu, 9 Mar 2023 03:23:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbjCIIWr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 9 Mar 2023 03:22:47 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9F181EBDC; Thu, 9 Mar 2023 00:21:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678350103; x=1709886103; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uA1jsUBpsTn1cyEGtu8uNzvvl9mod+0mi7D3hpv/8ZU=; b=YE7WcahnrA7kUKtR9GEKP6Yd3E0r2eOgmUfeEBK7M9VqSMUoD59TNfLN V3LmKsnGkdxBJVO4nhFZYF3BiHO2sP5g2Y1j1Tkk3RycjwN89zCVuienu /KzKejzgB/gQQLHbRRNlcWDAbvXpkEp8W4vH8QJ5Iazac2YVkX6mD4JdS dCDDp2dPlpGMfqfe5y4YkhAaw1bGzZrw/kSzSBLuRwDUcOlKVz6Pj5cXo CtfKc8/xqZEggEQYy+c4rKaxEbq2XWumShwNJaAX0vYfGUX/9M4l1yPrm pw9d20IxR4th985nM9zN/aGO0eWD7qt91nCzuEU1dq+48Jm3JW52dvvKo w==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="364025895" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="364025895" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="787473896" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="787473896" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:12 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> To: linux-serial@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jirislaby@kernel.org>, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> Subject: [PATCH 7/8] n_tty: Reindent if condition Date: Thu, 9 Mar 2023 10:20:34 +0200 Message-Id: <20230309082035.14880-8-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309082035.14880-1-ilpo.jarvinen@linux.intel.com> References: <20230309082035.14880-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759878448630042480?= X-GMAIL-MSGID: =?utf-8?q?1759878448630042480?= |
Series |
tty: Cleanups
|
|
Commit Message
Ilpo Järvinen
March 9, 2023, 8:20 a.m. UTC
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(-)
Comments
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;
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.
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)) { tty_warn(tty, "%d input overrun(s)\n", ldata->num_overrun); ldata->overrun_time = jiffies; ldata->num_overrun = 0;