From patchwork Tue Apr 4 19:17:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 79363 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp119974vqo; Tue, 4 Apr 2023 12:44:49 -0700 (PDT) X-Google-Smtp-Source: AKy350YQsOPP7MS17T+r2KdGRBsoapygYPXdhQHR1TX/zNfKnzpWP/vslK4uQ8Hlc6WmJUW+wJDG X-Received: by 2002:a62:6204:0:b0:625:d697:c386 with SMTP id w4-20020a626204000000b00625d697c386mr2768550pfb.22.1680637489049; Tue, 04 Apr 2023 12:44:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680637489; cv=none; d=google.com; s=arc-20160816; b=hM0xOQ6QhCpPfBGZ1e7zxgv+L4FvZDqmUQGDQZbNv1/V3d2C5zJD4i20GYz8q8vUOv tzyqc00I3IqEHfimF/7vF07JjvtlDEXSLexgGSd2MnOeNSa8RrLeR+oVFDAAgLzBfVMO sp/f1dT6dGWPjy5V+iXjrx7FiGfYvsplnstbAHhvVzOluTMHRG8hKdFRJfDIJpUh/tsd rZDdM94OA0syWxJTMXpuw9nRq2tzH0icc/VjeUSHLIp4jeeYtklmAP2L8SpZ1A0xhFtK MhcGLxl78Tbgi6PTx647OqtWK4FcaHf4z/wKEso6UZGntvn0sJ4P4HdGepWDktYFhPJJ jwng== 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=CA99O3oN+qmsdJNEwWXGj41D6iyd8mkWxcwccxE5ra8=; b=JNtfc/xqf++asyYP/ipn2LPtpz64xcF/FtWpaHyBWSBR6LcLQP3UO7zHmUY2Zxyv5S B/lf11YZD6+DzHPckdTdkYJT6WHpep0YUJZqN4VL2qTXJRruX6IMY+RG5i9sr3fuBBtZ ltO4UkZYXud7DWAopV7J4XVWi69/1+Hk4ScQZUw3FNUdzXJ2gJjVffh/uRAmVpb16rF6 nEcy2h1AVP+C6kA/SHH0rTy+q094Y6Z3ie0FJJuXX9fYg2lyJr3myYidCmwsh5w7vU2+ EBWjFj8BjJdNaoGw8LgRv/FNA52ncgM++nRSk6HME9qODNj+1oGV18ztNxoJAZEjJtx3 IjiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b="s9LX/P19"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020aa7946a000000b005a8ec89de5fsi10882631pfq.236.2023.04.04.12.44.36; Tue, 04 Apr 2023 12:44:49 -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="s9LX/P19"; 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 S235825AbjDDTRe (ORCPT + 99 others); Tue, 4 Apr 2023 15:17:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231477AbjDDTRc (ORCPT ); Tue, 4 Apr 2023 15:17:32 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 673C14491 for ; Tue, 4 Apr 2023 12:17:28 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id B7CF55FD03; Tue, 4 Apr 2023 22:17:24 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1680635844; bh=CA99O3oN+qmsdJNEwWXGj41D6iyd8mkWxcwccxE5ra8=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=s9LX/P19Ikc/up7r1woircu0F9JIZAyEZ2zKv4LPk/86hw3HfsPp/sXOMnToAuDqp 3yc3dmv0gq/WeQSBcmK2IJRyCqWNEt98EZmZKQK4w6gDozkPV2ziwJC6mOj4maF6/b bCY9d1LJ9POyB+WxQ+/F21bdI+zQWoQNB+fp/IQ1UQHCqgCJPLDslIsGLYYw1hUlbV k4FDWdy8bsz9q81PJIjBoy0iCVqzOYq0BHiRkTtVcF1gxBc4vTFT9JvJ6Na2gtIXJd dZ+7PwPcfPsj5F4lk7MmyPZc2EJEhyHRdKT8OGh6r3kFX80p5ojB5RJdfDdHpzCAN3 0K1gxPBJRUhqQ== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Tue, 4 Apr 2023 22:17:23 +0300 (MSK) From: Dmitry Rokosov To: , , , , , CC: , , , Dmitry Rokosov Subject: [PATCH v5] checkpatch: introduce proper bindings license check Date: Tue, 4 Apr 2023 22:17:15 +0300 Message-ID: <20230404191715.7319-1-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 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/04/04 17:27:00 #21030910 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762276135336376697?= X-GMAIL-MSGID: =?utf-8?q?1762276135336376697?= 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/ Signed-off-by: Dmitry Rokosov Reviewed-by: Rob Herring --- Changes v5 since v4 at [4]: - only capital OR is acceptable for SPDX per Rob's suggestion 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/ [4] https://lore.kernel.org/all/20230331121017.14324-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..7d9b63fffa9d 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 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 \S+/) { + WARN("SPDX_LICENSE_TAG", + "DT binding headers should be licensed (GPL-2.0-only OR .*)\n" . $herecurr); + } } } }