Skip to content

Commit a04bb4c

Browse files
rockosovakpm00
authored andcommitted
checkpatch: introduce proper bindings license check
All headers from 'include/dt-bindings/' must be verified by checkpatch together with Documentation bindings, because all of them are part of the whole DT bindings system. The requirement is dual licensed and matching patterns: * Schemas: /GPL-2\.0(?:-only)? OR BSD-2-Clause/ * Headers: /GPL-2\.0(?:-only)? OR \S+/ Above patterns suggested by Rob at: https://lore.kernel.org/all/CAL_Jsq+-YJsBO+LuPJ=ZQ=eb-monrwzuCppvReH+af7hYZzNaQ@mail.gmail.com The issue was found during patch review: https://lore.kernel.org/all/20230313201259.19998-4-ddrokosov@sberdevices.ru/ Link: https://lkml.kernel.org/r/20230404191715.7319-1-ddrokosov@sberdevices.ru Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru> Reviewed-by: Rob Herring <robh@kernel.org> Cc: Andy Whitcroft <apw@canonical.com> Cc: Dwaipayan Ray <dwaipayanray1@gmail.com> Cc: Joe Perches <joe@perches.com> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent d4cb626 commit a04bb4c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

scripts/checkpatch.pl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3763,7 +3763,7 @@ sub process {
37633763
"'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
37643764
}
37653765
if ($realfile =~ m@^Documentation/devicetree/bindings/@ &&
3766-
not $spdx_license =~ /GPL-2\.0.*BSD-2-Clause/) {
3766+
$spdx_license !~ /GPL-2\.0(?:-only)? OR BSD-2-Clause/) {
37673767
my $msg_level = \&WARN;
37683768
$msg_level = \&CHK if ($file);
37693769
if (&{$msg_level}("SPDX_LICENSE_TAG",
@@ -3773,6 +3773,11 @@ sub process {
37733773
$fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)/;
37743774
}
37753775
}
3776+
if ($realfile =~ m@^include/dt-bindings/@ &&
3777+
$spdx_license !~ /GPL-2\.0(?:-only)? OR \S+/) {
3778+
WARN("SPDX_LICENSE_TAG",
3779+
"DT binding headers should be licensed (GPL-2.0-only OR .*)\n" . $herecurr);
3780+
}
37763781
}
37773782
}
37783783
}

0 commit comments

Comments
 (0)