Skip to contentSkip to conversation

checkpatch: update $logFunctions

PATCH Superseded [email protected] 2 participants 4 messages Jan 13, 2017 – Jan 16, 2017 Checkpatch

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: update $logFunctions

From: Miles Chen <[email protected]>

Currently checkpatch.pl does not recognize printk_deferred* functions as log functions and complains about the line length of printk_deferred* functoins. Add printk_deferred* to logFunctions to fix it.

---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 982c52c..2b63f12 100755
@@ -425,7 +425,7 @@ our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b};
 
 our $logFunctions = qr{(?x:
 	printk(?:_ratelimited|_once|)|
-	(?:[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|deferred)(?:_ratelimited|_once|)|
 	WARN(?:_RATELIMIT|_ONCE|)|
 	panic|
 	MODULE_[A-Z_]+|
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 5 lines · On Fri, 2017-01-13 at 15:38 +0800, [email protected] wrote:

From: Miles Chen <[email protected]>

Currently checkpatch.pl does not recognize printk_deferred* functions as log functions and complains about the line length of printk_deferred* functoins. Add printk_deferred* to logFunctions to fix it.

Hi Miles.

Good idea, perhaps less good an implementation though.

scripts/checkpatch.pl

Quoted 1 line
scripts/checkpatch.pl +0 -0

[]

scripts/checkpatch.pl our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b}; · line 428

Quoted 6 lines
scripts/checkpatch.pl +1 -1
@@ -425,7 +425,7 @@ our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b};
 
 our $logFunctions = qr{(?x:
 	printk(?:_ratelimited|_once|)|
-	(?:[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|deferred)(?:_ratelimited|_once|)|

This should be a change on the line above like

	printk(?:_ratelimited|_once|_deferred|_deferred_once|)|

without a change on your suggested line.

Or perhaps changing both lines if there are to be macros/functions like pr_<level>_deferred_once someday.

   printk(?:_ratelimited|_once|_deferred|_deferred_once|)|

	(?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|_deferred|deferred_once|)|
author
#2 lore raw
Quoted 22 lines · Joe Perches
Quoted 5 lines · On Fri, 2017-01-13 at 15:38 +0800, [email protected] wrote:

From: Miles Chen <[email protected]>

Currently checkpatch.pl does not recognize printk_deferred* functions as log functions and complains about the line length of printk_deferred* functoins. Add printk_deferred* to logFunctions to fix it.

Hi Miles.

Good idea, perhaps less good an implementation though.

scripts/checkpatch.pl

Quoted 1 line
scripts/checkpatch.pl +0 -0

[]

scripts/checkpatch.pl our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b}; · line 428

Quoted 6 lines
scripts/checkpatch.pl +1 -1
@@ -425,7 +425,7 @@ our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b};
 
 our $logFunctions = qr{(?x:
 	printk(?:_ratelimited|_once|)|
-	(?:[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|deferred)(?:_ratelimited|_once|)|

This should be a change on the line above like

Quoted 3 lines
	printk(?:_ratelimited|_once|_deferred|_deferred_once|)|

without a change on your suggested line.

Hi Joe,

Thanks for your advice, I'll modify my patch and submit it again.

thanks,
Miles

Quoted 7 lines

Or perhaps changing both lines if there are to be macros/functions like pr_<level>_deferred_once someday.

printk(?:_ratelimited|_once|_deferred|_deferred_once|)|

	(?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|_deferred|deferred_once|)|
maintainer
#3 lore raw
Quoted 24 lines · Miles Chen
Quoted 23 lines · Joe Perches
Quoted 5 lines · On Fri, 2017-01-13 at 15:38 +0800, [email protected] wrote:

From: Miles Chen <[email protected]>

Currently checkpatch.pl does not recognize printk_deferred* functions as log functions and complains about the line length of printk_deferred* functoins. Add printk_deferred* to logFunctions to fix it.

Hi Miles.

Good idea, perhaps less good an implementation though.

scripts/checkpatch.pl

Quoted 1 line
scripts/checkpatch.pl +0 -0

[]

scripts/checkpatch.pl our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b}; · line 428

Quoted 6 lines
scripts/checkpatch.pl +1 -1
@@ -425,7 +425,7 @@ our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b};
 
 our $logFunctions = qr{(?x:
 	printk(?:_ratelimited|_once|)|
-	(?:[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|deferred)(?:_ratelimited|_once|)|

This should be a change on the line above like

Quoted 3 lines
Quoted 1 line
	printk(?:_ratelimited|_once|_deferred|_deferred_once|)|

Thanks for your advice, I'll modify my patch and submit it again.

Hello again Miles.

Actually, because perl matches the shortest match first, the deferred_once should be before the deferred above so deferred_once matches properly too. ie:

	printk(?:_ratelimited|_once|_deferred_once|_deferred|)|
Quoted 5 lines
Quoted 5 lines

Or perhaps changing both lines if there are to be macros/functions like pr_<level>_deferred_once someday.

printk(?:_ratelimited|_once|_deferred|_deferred_once|)|

	(?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|_deferred|deferred_once|)|

Here too for both lines if you submit this one.