Skip to contentSkip to conversation

checkpatch: add NOKPROBE_SYMBOL to the whitelist of lines that can occur immediately after functions

PATCH Applied Paul Walmsley 2 participants 2 messages Aug 7 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: add NOKPROBE_SYMBOL to the whitelist of lines that can occur immediately after functions

It's customary for NOKPROBE_SYMBOL() macro usage to appear immedately after a function's final closing brace, but checkpatch doesn't know that yet. As a result, checkpatch --strict incorrectly flags this common kernel pattern, e.g.,

CHECK: Please use a blank line after function/struct/union/enum declarations 33: FILE: arch/riscv/kernel/traps.c:273:
}
+NOKPROBE_SYMBOL(probe_single_step_handler);

Fix by adding NOKPROBE_SYMBOL to the whitelist of patterns that are cleared to appear immediately after functions.

---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)
scripts/checkpatch.pl +1 -0
index 2b7a42bbdd94..f8a57ed71f34 100755
@@ -4148,6 +4148,7 @@ sub process {
 		      $line =~ /^\+[a-z_]*init/ ||
 		      $line =~ /^\+\s*(?:static\s+)?[A-Z_]*ATTR/ ||
 		      $line =~ /^\+\s*DECLARE/ ||
+		      $line =~ /^\+\s*NOKPROBE_SYMBOL/ ||
 		      $line =~ /^\+\s*builtin_[\w_]*driver/ ||
 		      $line =~ /^\+\s*__setup/)) {
 			if (CHK("LINE_SPACING",
Signature · 1 line
2.53.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 1 line · Paul Walmsley

It's customary for NOKPROBE_SYMBOL() macro usage to appear immedately

immediate typo.

Andrew can you please fix it when applying?

Anyway, this is completely sensible, thanks.

Quoted 33 lines

after a function's final closing brace, but checkpatch doesn't know that yet. As a result, checkpatch --strict incorrectly flags this common kernel pattern, e.g.,

CHECK: Please use a blank line after function/struct/union/enum declarations 33: FILE: arch/riscv/kernel/traps.c:273:
}
+NOKPROBE_SYMBOL(probe_single_step_handler);

Fix by adding NOKPROBE_SYMBOL to the whitelist of patterns that are cleared to appear immediately after functions.

---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)
scripts/checkpatch.pl +1 -0
index 2b7a42bbdd94..f8a57ed71f34 100755
@@ -4148,6 +4148,7 @@ sub process {
 		      $line =~ /^\+[a-z_]*init/ ||
 		      $line =~ /^\+\s*(?:static\s+)?[A-Z_]*ATTR/ ||
 		      $line =~ /^\+\s*DECLARE/ ||
+		      $line =~ /^\+\s*NOKPROBE_SYMBOL/ ||
 		      $line =~ /^\+\s*builtin_[\w_]*driver/ ||
 		      $line =~ /^\+\s*__setup/)) {
 			if (CHK("LINE_SPACING",

```