Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp974612rwl; Fri, 31 Mar 2023 05:13:54 -0700 (PDT) X-Google-Smtp-Source: AKy350askJNTlpeqd/TLnarenSkeHY5TR6U+Ky60oYYe5zA7jcBmzrSLx7qn9JJW9ZAIqh2QBptw X-Received: by 2002:a17:906:7390:b0:947:8734:a058 with SMTP id f16-20020a170906739000b009478734a058mr3275427ejl.4.1680264834069; Fri, 31 Mar 2023 05:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680264834; cv=none; d=google.com; s=arc-20160816; b=AqpQET/lRmblT0ze6YYTn0YxCx8O56B6+gUCZxIVJMA6ldtr6mclOcr0CH59/N0MS8 cqlMbPkY9gIRq5n4m5BJLlmeMt9Du4YvciRv8kYnP7pbvuB8M77CuE8HLy9ykziFEvVK o7y7F7mzDxDdwqsnwjRmIx4wtC5PdXtWebQoLpAvGoSn6zLKGglgvi6qnKqKApVH1zBt SscKHUoBq6wnI9AtgdaDLP+0bkqTW07Jt2BzBAQkGZHYLhG1Kb5cYe6o53KbS4JP4dJk uyoSotMFv3Vox/zX8EgqumtJSY8tez0NmgOv79Boc+ghYs1Tke5hCpjL3OSlD/xT/Wqd bzbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FmwD7qi6XJRr3siHwuGZjBZVnCqsvUePCVoBN6rlnhs=; b=NzPhA45siwuIFeLCwNOG63+RrMNWYBlG8GKarTH7ut1y1oIG5JCvu8lOxmAVqFy9N/ 4ixZuiMRO2rnbQRRT1fOBldLM62ZFC8kOh/WlOtO3Xuni7lvTMsNUEf1EWY+TPZgXp3X ByQCGl7YiN73CtVWBUMkApNYFHLHvAO0GAYfOVJzxl7e21JSbVIXQmhhLMVO+90/DkbT VnVx2+nbWxS20tyVaWPp6PvvERBGb8UXVrosUpb6dpARw1O0CQQcJJ6MRa/cLKqJQ2xU 0B6A7kxjkXTPlQ7GYDbdUUVc28wrmMrCBb0JG4dI/yPaJJX1oB3Zup3BcjI6uQb/n3VB vahw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=pIDG1PNc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z25-20020a170906075900b009395b8121cesi1581599ejb.178.2023.03.31.05.13.28; Fri, 31 Mar 2023 05:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=pIDG1PNc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231771AbjCaMKe (ORCPT + 99 others); Fri, 31 Mar 2023 08:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230112AbjCaMKc (ORCPT ); Fri, 31 Mar 2023 08:10:32 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C79B51C1E8 for ; Fri, 31 Mar 2023 05:10:29 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id CE7C45FD0E; Fri, 31 Mar 2023 15:10:26 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1680264626; bh=FmwD7qi6XJRr3siHwuGZjBZVnCqsvUePCVoBN6rlnhs=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=pIDG1PNcXBRR5YZJcD3v1bmms/tmNJT8ZmRChESC3NOG6eJPjcSAh+5Sev1Mzuuzt KjEaEIxeSp3B6Ciihdk0YjWW10x1NvmQ2hA4SXJg0NXekP/mPAKQQ6H5Clauqpz0NL KPoAIFTke8/XMYIBDdKWuBBfAHS0sHar/fsWZ1OyW2yXEVLlkQBWol7CqHi+4Xfv5U tanPSHDgFWfoYPeVnmzM9TPRpfswptzOdT7VmGJYbzb7sWFv3nPw88P+fw+IPJStkR I3TsCaNEXSWg8UPxsGrO/R/EZN3YxDAmok5i6S9R0OqLcDSYc6KtpJeKIy6NcoGi/R r8aIM0c4hezTQ== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Fri, 31 Mar 2023 15:10:25 +0300 (MSK) From: Dmitry Rokosov To: , , , , , CC: , , , Dmitry Rokosov Subject: [PATCH v4] checkpatch: introduce proper bindings license check Date: Fri, 31 Mar 2023 15:10:17 +0300 Message-ID: <20230331121017.14324-1-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH01.sberdevices.ru (172.16.1.4) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/03/31 09:28:00 #21113278 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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|or) BSD-2-Clause/ * Headers: /GPL-2\.0(?:-only)? (?:OR|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/ Signed-off-by: Dmitry Rokosov --- Changes v4 since v3 at [3]: - introduce separate pattern for dt-bindings headers following Rob's suggestion Changes v3 since v2 at [2]: - replace 'not =~' expression with '!~' to be aligned with other checkpatch lines Changes v2 since v1 at [1]: - include/dt-bindings check is aligned to open parens - introduce more strict pattern for bindings license: /GPL-2\.0(?:-only|-or-later|\+)? (?:OR|or) BSD-2-Clause/ Links: [1] https://lore.kernel.org/all/20230317201621.15518-1-ddrokosov@sberdevices.ru/ [2] https://lore.kernel.org/all/20230320100027.27788-1-ddrokosov@sberdevices.ru/ [3] https://lore.kernel.org/all/20230320203350.13696-1-ddrokosov@sberdevices.ru/ --- scripts/checkpatch.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 78cc595b98ce..31f49bbe5458 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3710,7 +3710,7 @@ sub process { "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr); } if ($realfile =~ m@^Documentation/devicetree/bindings/@ && - not $spdx_license =~ /GPL-2\.0.*BSD-2-Clause/) { + $spdx_license !~ /GPL-2\.0(?:-only)? (?:OR|or) BSD-2-Clause/) { my $msg_level = \&WARN; $msg_level = \&CHK if ($file); if (&{$msg_level}("SPDX_LICENSE_TAG", @@ -3720,6 +3720,11 @@ sub process { $fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)/; } } + if ($realfile =~ m@^include/dt-bindings/@ && + $spdx_license !~ /GPL-2\.0(?:-only)? (?:OR|or) \S+/) { + WARN("SPDX_LICENSE_TAG", + "DT binding headers should be licensed (GPL-2.0-only OR .*)\n" . $herecurr); + } } } } -- 2.36.0