* [PATCH 1/1] scripts/checkpatch.pl: remove warning for pritk_deferred also [not found] <CGME20210824063513epcas5p46ba8b375c3e32fab210640a28041efb6@epcas5p4.samsung.com> @ 2021-08-24 6:35 ` Maninder Singh 2021-09-06 12:41 ` Maninder Singh 2021-09-06 20:15 ` Andy Whitcroft 0 siblings, 2 replies; 4+ messages in thread From: Maninder Singh @ 2021-08-24 6:35 UTC (permalink / raw) To: apw, joe, dwaipayanray1, lukas.bulwahn Cc: linux-kernel, a.sahrawat, Maninder Singh, Vaneet Narang printk_deferred also supossed to get loglevel, but checkpatch.pl returns warning for same. WARNING: Possible unnecessary KERN_ALERT +printk_deferred(KERN_ALERT "checking deferred\n"); total: 0 errors, 1 warnings, 20 lines checked Thus removing warning for printk_deferred also. Signed-off-by: Vaneet Narang <v.narang@samsung.com> Signed-off-by: Maninder Singh <maninder1.s@samsung.com> --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 161ce7fe5d1e..e3bea0d36c10 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6252,7 +6252,7 @@ sub process { } # check for logging functions with KERN_<LEVEL> - if ($line !~ /printk(?:_ratelimited|_once)?\s*\(/ && + if ($line !~ /printk(?:_ratelimited|_once|_deferred)?\s*\(/ && $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) { my $level = $1; if (WARN("UNNECESSARY_KERN_LEVEL", -- 2.17.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH 1/1] scripts/checkpatch.pl: remove warning for pritk_deferred also 2021-08-24 6:35 ` [PATCH 1/1] scripts/checkpatch.pl: remove warning for pritk_deferred also Maninder Singh @ 2021-09-06 12:41 ` Maninder Singh 2021-09-06 20:15 ` Andy Whitcroft 1 sibling, 0 replies; 4+ messages in thread From: Maninder Singh @ 2021-09-06 12:41 UTC (permalink / raw) To: apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com Cc: linux-kernel@vger.kernel.org, AMIT SAHRAWAT, Vaneet Narang Hi, Any comments? >WARNING: Possible unnecessary KERN_ALERT >+printk_deferred(KERN_ALERT "checking deferred\n"); > >total: 0 errors, 1 warnings, 20 lines checked > >Thus removing warning for printk_deferred also. > >Signed-off-by: Vaneet Narang <v.narang@samsung.com> >Signed-off-by: Maninder Singh <maninder1.s@samsung.com> >--- > scripts/checkpatch.pl | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl >index 161ce7fe5d1e..e3bea0d36c10 100755 >--- a/scripts/checkpatch.pl >+++ b/scripts/checkpatch.pl >@@ -6252,7 +6252,7 @@ sub process { > } > > # check for logging functions with KERN_<LEVEL> >- if ($line !~ /printk(?:_ratelimited|_once)?\s*\(/ && >+ if ($line !~ /printk(?:_ratelimited|_once|_deferred)?\s*\(/ && > $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) { > my $level = $1; > if (WARN("UNNECESSARY_KERN_LEVEL", >-- ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] scripts/checkpatch.pl: remove warning for pritk_deferred also 2021-08-24 6:35 ` [PATCH 1/1] scripts/checkpatch.pl: remove warning for pritk_deferred also Maninder Singh 2021-09-06 12:41 ` Maninder Singh @ 2021-09-06 20:15 ` Andy Whitcroft 2021-09-10 12:45 ` Maninder Singh 1 sibling, 1 reply; 4+ messages in thread From: Andy Whitcroft @ 2021-09-06 20:15 UTC (permalink / raw) To: Maninder Singh Cc: joe, dwaipayanray1, lukas.bulwahn, linux-kernel, a.sahrawat, Vaneet Narang On Tue, Aug 24, 2021 at 12:05:00PM +0530, Maninder Singh wrote: > printk_deferred also supossed to get loglevel, but checkpatch.pl > returns warning for same. > > WARNING: Possible unnecessary KERN_ALERT > +printk_deferred(KERN_ALERT "checking deferred\n"); > > total: 0 errors, 1 warnings, 20 lines checked > > Thus removing warning for printk_deferred also. > > Signed-off-by: Vaneet Narang <v.narang@samsung.com> > Signed-off-by: Maninder Singh <maninder1.s@samsung.com> > --- > scripts/checkpatch.pl | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 161ce7fe5d1e..e3bea0d36c10 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -6252,7 +6252,7 @@ sub process { > } > > # check for logging functions with KERN_<LEVEL> > - if ($line !~ /printk(?:_ratelimited|_once)?\s*\(/ && > + if ($line !~ /printk(?:_ratelimited|_once|_deferred)?\s*\(/ && > $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) { > my $level = $1; > if (WARN("UNNECESSARY_KERN_LEVEL", > -- > 2.17.1 > It looks sensible to add `_deferred`, there also looks to be an `_deferred_once` variant which should also be added. See the first stanza of `$logFunctions`. We might also consider splitting up `$logFunctions` so that we can consume the reset without that first stanza? Something like this (completly untested): our $logFunctionsCore = qr{(?x: (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| TP_printk| WARN(?:_RATELIMIT|_ONCE|)| panic| MODULE_[A-Z_]+| seq_vprintf|seq_printf|seq_puts )}; our $logFunctions = qr{(?x: printk(?:_ratelimited|_once|_deferred_once|_deferred|)| $logFunctionsCore )}; -apw ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH 1/1] scripts/checkpatch.pl: remove warning for pritk_deferred also 2021-09-06 20:15 ` Andy Whitcroft @ 2021-09-10 12:45 ` Maninder Singh 0 siblings, 0 replies; 4+ messages in thread From: Maninder Singh @ 2021-09-10 12:45 UTC (permalink / raw) To: Andy Whitcroft Cc: joe@perches.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, linux-kernel@vger.kernel.org, AMIT SAHRAWAT, Vaneet Narang Hi, >It looks sensible to add `_deferred`, there also looks to be an >`_deferred_once` variant which should also be added. See the first >stanza of `$logFunctions`. We might also consider splitting up >`$logFunctions` so that we can consume the reset without that first >stanza? Something like this (completly untested): > > our $logFunctionsCore = qr{(?x: > (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| > TP_printk| > WARN(?:_RATELIMIT|_ONCE|)| > panic| > MODULE_[A-Z_]+| > seq_vprintf|seq_printf|seq_puts > )}; > our $logFunctions = qr{(?x: > printk(?:_ratelimited|_once|_deferred_once|_deferred|)| > $logFunctionsCore > )}; > sent V2 patch with testing basic checks: https://lkml.org/lkml/2021/9/7/329 $ cat test.c printk_deferred(KERN_ALERT "checking deferred\n"); printk_deferred_once(KERN_ALERT "checking deferred\n"); printk(KERN_ERR"error"); pr_emerg("Protocol: %#06hx\n", ntohs(eth->h_proto)); printk_deferred(KERN_ALERT "Protocol: %#06hx\n", ntohs(eth->h_proto)); WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... #22: FILE: test.c:22: +printk(KERN_ERR"error"); WARNING: Integer promotion: Using 'h' in '%#06hx' is unnecessary #23: FILE: test.c:23: +pr_emerg("Protocol: %#06hx\n", ntohs(eth->h_proto)); WARNING: Integer promotion: Using 'h' in '%#06hx' is unnecessary #24: FILE: test.c:24: +printk_deferred(KERN_ALERT "Protocol: %#06hx\n", ntohs(eth->h_proto)); Thanks, Maninder Singh ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-10 12:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20210824063513epcas5p46ba8b375c3e32fab210640a28041efb6@epcas5p4.samsung.com>
2021-08-24 6:35 ` [PATCH 1/1] scripts/checkpatch.pl: remove warning for pritk_deferred also Maninder Singh
2021-09-06 12:41 ` Maninder Singh
2021-09-06 20:15 ` Andy Whitcroft
2021-09-10 12:45 ` Maninder Singh
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox