mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Walmsley <pjw@kernel.org>
To: apw@canonical.com, joe@perches.com, linux-kernel@vger.kernel.org
Cc: Nam Cao <namcao@linutronix.de>, Jisheng Zhang <jszhang@kernel.org>
Subject: [PATCH] checkpatch: add NOKPROBE_SYMBOL to the whitelist of lines that can occur immediately after functions
Date: Thu, 6 Aug 2026 19:00:47 -0600 (MDT)	[thread overview]
Message-ID: <130be7db-6098-86a4-60fe-0c1a5d9e30ba@kernel.org> (raw)


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.

Cc: Nam Cao <namcao@linutronix.de>
Cc: Jisheng Zhang <jszhang@kernel.org>
Signed-off-by: Paul Walmsley <pjw@kernel.org>
---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2b7a42bbdd94..f8a57ed71f34 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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",
-- 
2.53.0


WARNING: multiple messages have this Message-ID
From: Petr Vorel <pvorel@suse.cz>
To: pjw@kernel.org, apw@canonical.com, joe@perches.com,
	linux-kernel@vger.kernel.org
Cc: jszhang@kernel.org, namcao@linutronix.de,
	Andrew Morton <akpm@linux-foundation.org>,
	Petr Vorel <pvorel@suse.cz>
Subject: [PATCH] checkpatch: add NOKPROBE_SYMBOL to the whitelist of lines that can occur immediately after functions
Date: Mon, 10 Aug 2026 18:57:28 +0200	[thread overview]
Message-ID: <130be7db-6098-86a4-60fe-0c1a5d9e30ba@kernel.org> (raw)
Message-ID: <20260810165728.8_Jw_VWUPFMgn9Ah5yGr8upwcMLMa5zLc0Hv02uNCkw@z> (raw)
In-Reply-To: <130be7db-6098-86a4-60fe-0c1a5d9e30ba@kernel.org>

From: Paul Walmsley <pjw@kernel.org>

> 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.

> Cc: Nam Cao <namcao@linutronix.de>
> Cc: Jisheng Zhang <jszhang@kernel.org>
> Signed-off-by: Paul Walmsley <pjw@kernel.org>
> ---
>  scripts/checkpatch.pl | 1 +
>  1 file changed, 1 insertion(+)

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 2b7a42bbdd94..f8a57ed71f34 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -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",

+1

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

             reply	other threads:[~2026-08-07  1:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07  1:00 Paul Walmsley [this message]
2026-08-07  1:17 ` Joe Perches
2026-08-10 16:57 ` Petr Vorel

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=130be7db-6098-86a4-60fe-0c1a5d9e30ba@kernel.org \
    --to=pjw@kernel.org \
    --cc=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=jszhang@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namcao@linutronix.de \
    /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

all inboxes | Powered by JetHome®