linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
	linux-pm@vger.kernel.org, Petr Mladek <pmladek@suse.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>
Cc: "Thomas Weißschuh" <linux@weissschuh.net>,
	linux-kernel@vger.kernel.org,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Dwaipayan Ray" <dwaipayanray1@gmail.com>,
	"Lukas Bulwahn" <lukas.bulwahn@gmail.com>
Subject: [PATCH v2 2/3] checkpatch: handle new pr_<level>_cont macros
Date: Fri, 25 Nov 2022 20:09:47 +0100	[thread overview]
Message-ID: <20221125190948.2062-3-linux@weissschuh.net> (raw)
In-Reply-To: <20221125190948.2062-1-linux@weissschuh.net>

These new macros from include/linux/printk.h replace the usage of plain
pr_cont().

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 scripts/checkpatch.pl | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1e5e66ae5a52..fb1747639c9c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -590,7 +590,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|)|
+	(?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|_cont|)|
 	TP_printk|
 	WARN(?:_RATELIMIT|_ONCE|)|
 	panic|
@@ -6374,11 +6374,17 @@ sub process {
 		}
 
 # check for logging continuations
-		if ($line =~ /\bprintk\s*\(\s*KERN_CONT\b|\bpr_cont\s*\(/) {
+		if ($line =~ /\bprintk\s*\(\s*KERN_CONT\b|\bpr_([a-z]+_)?cont\s*\(/) {
 			WARN("LOGGING_CONTINUATION",
 			     "Avoid logging continuation uses where feasible\n" . $herecurr);
 		}
 
+# check for logging continuations without explicit level
+		if ($line =~ /\bpr_cont\s*\(/) {
+			WARN("LOGGING_CONTINUATION_WITHOUT_LEVEL",
+			     "Avoid logging continuation without level\n" . $herecurr);
+		}
+
 # check for unnecessary use of %h[xudi] and %hh[xudi] in logging functions
 		if (defined $stat &&
 		    $line =~ /\b$logFunctions\s*\(/ &&
-- 
2.38.1


  parent reply	other threads:[~2022-11-25 19:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 19:09 [PATCH v2 0/3] printk: introduce new macros pr_<level>_cont() Thomas Weißschuh
2022-11-25 19:09 ` [PATCH v2 1/3] " Thomas Weißschuh
2022-11-25 20:18   ` Joe Perches
2022-11-25 20:33     ` Thomas Weißschuh
2022-11-30 13:59       ` Petr Mladek
2022-11-30 14:50         ` Thomas Weißschuh
2022-12-02 12:21           ` Petr Mladek
2022-11-30 14:23   ` Petr Mladek
2022-11-30 14:56     ` Thomas Weißschuh
2022-12-02 12:27       ` Petr Mladek
2022-11-25 19:09 ` Thomas Weißschuh [this message]
2022-11-25 20:17   ` [PATCH v2 2/3] checkpatch: handle new pr_<level>_cont macros Joe Perches
2022-11-30 14:51     ` Petr Mladek
2022-11-25 19:09 ` [PATCH v2 3/3] power: process: use explicit levels for printk continuations Thomas Weißschuh
2022-11-25 19:53   ` Joe Perches
2022-11-25 20:41     ` Thomas Weißschuh
2022-11-30 15:06       ` Petr Mladek
2022-11-30 17:57 ` [PATCH v2 0/3] printk: introduce new macros pr_<level>_cont() Rafael J. Wysocki
2022-11-30 23:37   ` Thomas Weißschuh
2022-12-01 10:32     ` Petr Mladek

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=20221125190948.2062-3-linux@weissschuh.net \
    --to=linux@weissschuh.net \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=pmladek@suse.com \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.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;
as well as URLs for NNTP newsgroup(s).