Message ID | 20231201151446.1593472-1-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp1194557vqy; Fri, 1 Dec 2023 07:16:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUSqQzWtc9eV1ignfit0Jn1Fko7JBs5C+GWkCXkqx2hqTHvKCK6kPiZPsdksuzyiul5XpJ X-Received: by 2002:a05:6a00:9395:b0:6cd:e10b:c5d3 with SMTP id ka21-20020a056a00939500b006cde10bc5d3mr8131877pfb.30.1701443763469; Fri, 01 Dec 2023 07:16:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701443763; cv=none; d=google.com; s=arc-20160816; b=XT2KfTdggxrZml1axqHAe2/s0MB3hi4R4wnHaFIzag2LXUFQC0V0enHjVQDoXD7u8p BZqnaoPhu6IIF4gLUNJLJdImV1CzR9rnBYA/IEoK7TIonjLLSFXs603UqOEmwGQ2c7qV 4ntKfJElu8ANQ1RZ++MHO4in4VxddnAu1AvL+lVB3SLrUzG5IhIEK957raPHNNdPb6pR szOJ8rpBgIdBqMJOTUdfbccdvuWcXfai5qrgKgpBeQ61LVPpBCLo0hZOL+uuQHdQqtO8 apsV2BYnFnO6WPgCBXiUkNr5JEAiG/z626ipG+4feKU1ZGCPX/v5jccJ2vR/T1OMJH6W RTeg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=JGSKrsX5JZPTrHrtbs3pHvk2uSyMg1cQnDp9DxIrBhg=; fh=MEotuWj8+5ZFrww6dUYZu6uOeSR66jDdxDREYp8bB9s=; b=OzeKgBLOcbseMgQaKSG4qN4Be/VL73CEWIPd2AfLJnVaC7kK0T3mM3AOj5zoondVQ/ Ekx4bHuD+BygmaDXJI1nkQYV+y4cxI6UITU11Ku+6oH7NcgG9gnfnLvWVJNnBoSGWn4J MMPiKv8S0QcXmuBQc/d0hZXPUiZTgAqMk48flArsH3DQeIZ+8L/sVduzaTorexO0cm6/ 0s+1N5u0Vwfb6LTvM3c7dDLJfIYfv+5t9qQJ4YeawCqhKTpfC5VOgXvbkDYeCIScIEBa mb5DQRrqh3GJ5E7WUu7cyyRq79U2VQhoKuWrb8Zca7HRqJZ4sgCkccxJplB49HTCZ3Gi Hdzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=X8B+97u0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id cf5-20020a056a02084500b005bce8cfb592si3353018pgb.245.2023.12.01.07.16.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:16:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=X8B+97u0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2E1E68116E44; Fri, 1 Dec 2023 07:15:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379395AbjLAPOy (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Fri, 1 Dec 2023 10:14:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379394AbjLAPOv (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 1 Dec 2023 10:14:51 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 481E9170B for <linux-kernel@vger.kernel.org>; Fri, 1 Dec 2023 07:14:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701443692; x=1732979692; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=2nPgeu78BldoNDzIaZF7ykkc2+YQvrAlpn9sQnj1FMw=; b=X8B+97u06VeSKkzfYRyrRvApJFOStQ0Z8TOqA2J4cwAjOXjheZhlFqde zc428PiKrLSc9Prw/fFR9AkiVUVlhXKoN319Q6TWnTGzNKlc4oP9UiFxG D9swOzIwC5+HQnooE78PU35EbyxJpLCs9PGEYTgKV6rjaKlxMOJ8A+UBr D7yJgrBidsG033vw64BS4mRQUK2SbWgfai8hc8+bCJJDQorMouevOMV/K wthKgCm1ODzqXEP/d+KQreXmhyiEOj5LnXSLLT+XNb0yKNDzYfs7Yh+Da 51DnE8CSZtUje0ZDTZWbV07hti7FJyGR6bZ3snElKDQ4CFAv9sTCGoSwL g==; X-IronPort-AV: E=McAfee;i="6600,9927,10911"; a="378541626" X-IronPort-AV: E=Sophos;i="6.04,241,1695711600"; d="scan'208";a="378541626" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2023 07:14:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10911"; a="913604674" X-IronPort-AV: E=Sophos;i="6.04,241,1695711600"; d="scan'208";a="913604674" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 01 Dec 2023 07:14:49 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5434579F; Fri, 1 Dec 2023 17:14:48 +0200 (EET) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org Cc: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>, Dwaipayan Ray <dwaipayanray1@gmail.com>, Lukas Bulwahn <lukas.bulwahn@gmail.com>, Guenter Roeck <linux@roeck-us.net>, Andy Shevchenko <andriy.shevchenko@linux.intel.com> Subject: [PATCH v1 1/1] checkpatch: Add dev_err_probe() to the list of Log Functions Date: Fri, 1 Dec 2023 17:14:46 +0200 Message-ID: <20231201151446.1593472-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 01 Dec 2023 07:15:08 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784093095537650187 X-GMAIL-MSGID: 1784093095537650187 |
Series |
[v1,1/1] checkpatch: Add dev_err_probe() to the list of Log Functions
|
|
Commit Message
Andy Shevchenko
Dec. 1, 2023, 3:14 p.m. UTC
dev_err_probe() is missing in the list of Log Functions and hence
checkpatch issues a warning in the cases when any other function
in use won't trigger it. Add dev_err_probe() to the list to behave
consistently.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
scripts/checkpatch.pl | 1 +
1 file changed, 1 insertion(+)
Comments
On 12/1/23 07:14, Andy Shevchenko wrote: > dev_err_probe() is missing in the list of Log Functions and hence > checkpatch issues a warning in the cases when any other function > in use won't trigger it. Add dev_err_probe() to the list to behave > consistently. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > scripts/checkpatch.pl | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index a94ed6c46a6d..c40f3f784f7e 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -593,6 +593,7 @@ our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b}; > our $logFunctions = qr{(?x: > printk(?:_ratelimited|_once|_deferred_once|_deferred|)| > (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| > + dev_err_probe| > TP_printk| > WARN(?:_RATELIMIT|_ONCE|)| > panic| Not sure if I agree. The difference here is that dev_err_probe() has two additional parameters ahead of the string. I would very much prefer to have those two additional parameters on a separate line if the string is too long to fit in 100 columns with those two parameters on the same line. In other words, I very much prefer dev_err_probe(dev, -ESOMETHING, "very long string"); over dev_err_probe(dev, -ESOMETHING, "very long string"); and I don't really think that the latter has any benefits. Also note that other dev_xxx() log functions are not included in the above test and would still generate warnings. Accepting dev_err_probe(dev, -ESOMETHING, "very long string"); but not dev_err(dev, "very long string"); doesn't really make sense to me. Guenter
On Fri, Dec 01, 2023 at 08:01:28AM -0800, Guenter Roeck wrote: > On 12/1/23 07:14, Andy Shevchenko wrote: > > dev_err_probe() is missing in the list of Log Functions and hence > > checkpatch issues a warning in the cases when any other function > > in use won't trigger it. Add dev_err_probe() to the list to behave > > consistently. ... > Not sure if I agree. The difference here is that dev_err_probe() > has two additional parameters ahead of the string. I would very much prefer > to have those two additional parameters on a separate line if the string is > too long to fit in 100 columns with those two parameters on the same line. > In other words, I very much prefer > > dev_err_probe(dev, -ESOMETHING, > "very long string"); > over > dev_err_probe(dev, -ESOMETHING, "very long string"); > > and I don't really think that the latter has any benefits. > > Also note that other dev_xxx() log functions are not included in the above test > and would still generate warnings. Accepting > > dev_err_probe(dev, -ESOMETHING, "very long string"); > but not > dev_err(dev, "very long string"); They are included, see the line previous to the added one. (Regexp covers something like x_y_()* and x_*() families with the explicitly listed * suffixes.) That's why _this_ change makes it consistent. > doesn't really make sense to me.
On Fri, Dec 01, 2023 at 06:17:51PM +0200, Andy Shevchenko wrote: > On Fri, Dec 01, 2023 at 08:01:28AM -0800, Guenter Roeck wrote: > > On 12/1/23 07:14, Andy Shevchenko wrote: > > > dev_err_probe() is missing in the list of Log Functions and hence > > > checkpatch issues a warning in the cases when any other function > > > in use won't trigger it. Add dev_err_probe() to the list to behave > > > consistently. ... > > Not sure if I agree. The difference here is that dev_err_probe() > > has two additional parameters ahead of the string. I would very much prefer > > to have those two additional parameters on a separate line if the string is > > too long to fit in 100 columns with those two parameters on the same line. > > In other words, I very much prefer > > > > dev_err_probe(dev, -ESOMETHING, > > "very long string"); > > over > > dev_err_probe(dev, -ESOMETHING, "very long string"); > > > > and I don't really think that the latter has any benefits. > > > > Also note that other dev_xxx() log functions are not included in the above test > > and would still generate warnings. Accepting > > > > dev_err_probe(dev, -ESOMETHING, "very long string"); > > but not > > dev_err(dev, "very long string"); > > They are included, see the line previous to the added one. > (Regexp covers something like x_y_()* and x_*() families with the explicitly Should read: x_y_*() > listed * suffixes.) > > That's why _this_ change makes it consistent. > > > doesn't really make sense to me.
On 12/1/23 08:17, Andy Shevchenko wrote: > On Fri, Dec 01, 2023 at 08:01:28AM -0800, Guenter Roeck wrote: >> On 12/1/23 07:14, Andy Shevchenko wrote: >>> dev_err_probe() is missing in the list of Log Functions and hence >>> checkpatch issues a warning in the cases when any other function >>> in use won't trigger it. Add dev_err_probe() to the list to behave >>> consistently. > > ... > >> Not sure if I agree. The difference here is that dev_err_probe() >> has two additional parameters ahead of the string. I would very much prefer >> to have those two additional parameters on a separate line if the string is >> too long to fit in 100 columns with those two parameters on the same line. >> In other words, I very much prefer >> >> dev_err_probe(dev, -ESOMETHING, >> "very long string"); >> over >> dev_err_probe(dev, -ESOMETHING, "very long string"); >> >> and I don't really think that the latter has any benefits. >> >> Also note that other dev_xxx() log functions are not included in the above test >> and would still generate warnings. Accepting >> >> dev_err_probe(dev, -ESOMETHING, "very long string"); >> but not >> dev_err(dev, "very long string"); > > They are included, see the line previous to the added one. > (Regexp covers something like x_y_()* and x_*() families with the explicitly > listed * suffixes.) > > That's why _this_ change makes it consistent. > Hmm ok. Still don't like it. Guenter
On Fri, Dec 01, 2023 at 08:34:14AM -0800, Guenter Roeck wrote: > On 12/1/23 08:17, Andy Shevchenko wrote: > > On Fri, Dec 01, 2023 at 08:01:28AM -0800, Guenter Roeck wrote: > > > On 12/1/23 07:14, Andy Shevchenko wrote: > > > > dev_err_probe() is missing in the list of Log Functions and hence > > > > checkpatch issues a warning in the cases when any other function > > > > in use won't trigger it. Add dev_err_probe() to the list to behave > > > > consistently. ... > > > Not sure if I agree. The difference here is that dev_err_probe() > > > has two additional parameters ahead of the string. I would very much prefer > > > to have those two additional parameters on a separate line if the string is > > > too long to fit in 100 columns with those two parameters on the same line. > > > In other words, I very much prefer > > > > > > dev_err_probe(dev, -ESOMETHING, > > > "very long string"); > > > over > > > dev_err_probe(dev, -ESOMETHING, "very long string"); > > > > > > and I don't really think that the latter has any benefits. > > > > > > Also note that other dev_xxx() log functions are not included in the above test > > > and would still generate warnings. Accepting > > > > > > dev_err_probe(dev, -ESOMETHING, "very long string"); > > > but not > > > dev_err(dev, "very long string"); > > > > They are included, see the line previous to the added one. > > (Regexp covers something like x_y_()* and x_*() families with the explicitly > > listed * suffixes.) > > > > That's why _this_ change makes it consistent. > > > > Hmm ok. Still don't like it. But then it's orthogonal to the change as with consistent behaviour you may propose a fix that makes sure that long string literal goes to a separate line (after a threshold) for _all_ of them at once. Currently the behaviour is inconsistent independently on somebody's preferences...
On Fri, 2023-12-01 at 19:07 +0200, Andy Shevchenko wrote: > Currently the [style] behaviour is > inconsistent independently on somebody's preferences... <shrug> Which is IMO perfectly fine. The ratio of multiple line and single line uses of dev_err_probe is ~50:50 $ git grep -w dev_err_probe | grep -P ';\s*$' | wc -l 1532 $ git grep -w dev_err_probe | grep -P ',\s*$' | wc -l 1871
On Fri, Dec 01, 2023 at 02:29:57PM -0800, Joe Perches wrote: > On Fri, 2023-12-01 at 19:07 +0200, Andy Shevchenko wrote: > > Currently the [style] behaviour is > > inconsistent independently on somebody's preferences... > > <shrug> Which is IMO perfectly fine. > > The ratio of multiple line and single line uses > of dev_err_probe is ~50:50 > > $ git grep -w dev_err_probe | grep -P ';\s*$' | wc -l > 1532 > $ git grep -w dev_err_probe | grep -P ',\s*$' | wc -l > 1871 My point is that checkpatch won't warn on dev_err(..., "very long line\n"); while doing the same on dev_err_probe() even if the line is shorter than in dev_err() case. This inconsistency I am talking about.
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a94ed6c46a6d..c40f3f784f7e 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -593,6 +593,7 @@ our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b}; our $logFunctions = qr{(?x: printk(?:_ratelimited|_once|_deferred_once|_deferred|)| (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| + dev_err_probe| TP_printk| WARN(?:_RATELIMIT|_ONCE|)| panic|