Skip to contentSkip to conversation

checkpatch: allow uppercase logging function names

PATCH In review Wesley Wiser 3 participants 4 messages Dec 4, 2014 – Dec 6, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: allow uppercase logging function names

Some kernel logging functions are prefixed with uppercase letters such as TP_printk, DUMP_printk, DBG_printk, DEBC_printk, etc. The previous behavior only allowed logging functions (which may exceed the 80 character line limit) to be prefixed by lowercase letters and numbers.

---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 374abf4..3b08f1e 100755
@@ -343,7 +343,7 @@ our $typeTypedefs = qr{(?x:
 
 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-zA-Z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
 	WARN(?:_RATELIMIT|_ONCE|)|
 	panic|
 	MODULE_[A-Z_]+|
Signature · 1 line
1.8.4.5
maintainer
#1 lore raw
Quoted 4 lines · Wesley Wiser

Some kernel logging functions are prefixed with uppercase letters such as TP_printk, DUMP_printk, DBG_printk, DEBC_printk, etc. The previous behavior only allowed logging functions (which may exceed the 80 character line limit) to be prefixed by lowercase letters and numbers.

I'm not sure that these should be encouraged.
I'd prefer to make these lower case instead.

The regex also allows mixed case like Tp_printk.

Maybe if it was something like
(?:[a-z0-9]+_|[A-Z0-9]+_){1,2}

but it still seems undesirable.

Quoted 13 lines
scripts/checkpatch.pl new file +1 -1
index 374abf4..3b08f1e 100755
@@ -343,7 +343,7 @@ our $typeTypedefs = qr{(?x:
 
 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-zA-Z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
 	WARN(?:_RATELIMIT|_ONCE|)|
 	panic|
 	MODULE_[A-Z_]+|
#3 lore raw
In reply to Wesley Wiser

Hi Joe,

Thanks for taking a look at this. Do you think I should look into fixing the casing of these functions instead? Some of these functions look like they're being called in a lot of places. TP_printk, for example, is getting called over 1000 times according to git grep.

Wesley Wiser

Quoted 9 lines · Joe Perches

I'm not sure that these should be encouraged.
I'd prefer to make these lower case instead.

The regex also allows mixed case like Tp_printk.

Maybe if it was something like
(?:[a-z0-9]+_|[A-Z0-9]+_){1,2}

but it still seems undesirable.