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
3763 "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);3763 "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
3764 }3764 }
3765 if ($realfile =~ m@^Documentation/devicetree/bindings/@ &&3765 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/) {
3767 my $msg_level = \&WARN;3767 my $msg_level = \&WARN;
3768 $msg_level = \&CHK if ($file);3768 $msg_level = \&CHK if ($file);
3769 if (&{$msg_level}("SPDX_LICENSE_TAG",3769 if (&{$msg_level}("SPDX_LICENSE_TAG",
@@ -3773,6 +3773,11 @@ sub process { · 3 unmodified lines
3773 $fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)/;3773 $fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)/;
3774 }3774 }
3775 }3775 }
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 }
3776 }3781 }
3777 }3782 }
3778 }3783 }