History

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/

Dmitry Rokosov committed 3 years ago

Commit a04bb4c1 parent d4cb6261 file · +6 −1Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+6−1
@@ -3763,7 +3763,7 @@ sub process { · 3762 unmodified lines
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 { · 3 unmodified lines
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 }