summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorPetr Vorel <pvorel@suse.cz>2026-09-04 13:02:29 +0200
committerAndrew Morton <akpm@linux-foundation.org>2026-10-10 18:56:45 -0700
commit4b5b44b161dbc64b89b85b91dfb63e8ad3f6ae98 (patch)
treeb46fb4856948c29f4e07a23819731d8931d24633 /scripts/checkpatch.pl
parent3dc89677fbba48e10653cff2c7a8972b62eb22fd (diff)
downloadlinux-next-4b5b44b161dbc64b89b85b91dfb63e8ad3f6ae98.tar.gz
linux-next-4b5b44b161dbc64b89b85b91dfb63e8ad3f6ae98.zip
checkpatch: add --userspace to force userspace rules
Also allow to use --no-userspace for userspace projects which vendored checkpatch.pl and use --userspace globally to be able switch it off for files with kernel code. Link: https://lore.kernel.org/20260904110230.1219037-4-pvorel@suse.cz Signed-off-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Whitcroft <apw@canonical.com> Cc: Dwaipayan Ray <dwaipayanray1@gmail.com> Cc: Joe Perches <joe@perches.com> Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b458c7f22684..ead35e6abba7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -63,6 +63,7 @@ my $env_config_dir = 'CHECKPATCH_CONFIG_DIR';
my $max_line_length = 100;
my $ignore_perl_version = 0;
my $spdx_cxx_comments = 0;
+my $userspace;
my $minimum_perl_version = 5.10.0;
my $min_conf_desc_length = 4;
my $spelling_file = "$D/spelling.txt";
@@ -143,6 +144,7 @@ Options:
(required by old toolchains), allow also C++
comments (//).
NOTE: it should *not* be used for Linux mainline.
+ --userspace Force rules specific for userspace.
--codespell Use the codespell dictionary for spelling/typos
(default:$codespellfile)
--codespellfile Use this codespell dictionary
@@ -358,6 +360,7 @@ GetOptions(
'codespell!' => \$codespell,
'codespellfile=s' => \$user_codespellfile,
'typedefsfile=s' => \$typedefsfile,
+ 'userspace!' => \$userspace,
'color=s' => \$color,
'no-color' => \$color, #keep old behaviors of -nocolor
'nocolor' => \$color, #keep old behaviors of -nocolor
@@ -2667,6 +2670,9 @@ sub exclude_global_initialisers {
sub is_userspace {
my ($realfile) = @_;
+
+ return $userspace if (defined $userspace);
+
return ($realfile =~ m@^tools/@ ||
$realfile =~ m@^scripts/@ ||
$realfile =~ m@^arch/.*/tools/@);