mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: linux-kernel@vger.kernel.org
Cc: Petr Vorel <pvorel@suse.cz>, Joe Perches <joe@perches.com>,
	Simon Glass <sjg@chromium.org>,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>
Subject: [PATCH v3 2/3] checkpatch: Ignore <inttypes.h> format macros for userspace tools
Date: Wed, 20 May 2026 12:08:28 +0200	[thread overview]
Message-ID: <20260520100829.93791-3-pvorel@suse.cz> (raw)
In-Reply-To: <20260520100829.93791-1-pvorel@suse.cz>

Constants from <inttypes.h> are used only in userspace tools, they are
from ISO C99, let's don't report it:

    arch/mips/boot/tools/relocs.c:572: CHECK: Avoid CamelCase: <PRIx32>
    arch/s390/tools/relocs.c:52: CHECK: Avoid CamelCase: <PRIu64>
    tools/testing/selftests/mm/vm_util.c:244: CHECK: Avoid CamelCase: <SCNu64>

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v2->v3:
* Fix unintentional disablement of CamelCase warnings on non-userspace
  sources (sashiko).

Link to v2:
https://lore.kernel.org/lkml/20260519162004.81665-1-pvorel@suse.cz/
https://sashiko.dev/#/patchset/20260519162004.81665-1-pvorel%40suse.cz

 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 663064f32dae..60da43b00d55 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5945,6 +5945,8 @@ sub process {
 #Ignore SI style variants like nS, mV and dB
 #(ie: max_uV, regulator_min_uA_show, RANGE_mA_VALUE)
 			    $var !~ /^(?:[a-z0-9_]*|[A-Z0-9_]*)?_?[a-z][A-Z](?:_[a-z0-9_]+|_[A-Z0-9_]+)?$/ &&
+#Ignore <inttypes.h> format macros (e.g. PRIu64, SCNu64)
+			    (is_userspace($realfile) ? $var !~ /^(?:PRI|SCN)[dioux][A-Z0-9]+$/ : 1) &&
 #Ignore some three character SI units explicitly, like MiB and KHz
 			    $var !~ /^(?:[a-z_]*?)_?(?:[KMGT]iB|[KMGT]?Hz)(?:_[a-z_]+)?$/) {
 				while ($var =~ m{\b($Ident)}g) {
-- 
2.54.0


  parent reply	other threads:[~2026-05-20 10:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20 10:08 [PATCH v3 0/3] checkpatch: userspace improvements Petr Vorel
2026-05-20 10:08 ` [PATCH v3 1/3] checkpatch: Add more user space directories to is_userspace() Petr Vorel
2026-05-20 15:13   ` Joe Perches
2026-05-20 20:35     ` Petr Vorel
2026-05-20 10:08 ` Petr Vorel [this message]
2026-05-20 10:08 ` [PATCH v3 3/3] checkpatch: Add new option to force userspace Petr Vorel
2026-05-20 20:37   ` 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=20260520100829.93791-3-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=sjg@chromium.org \
    /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®