From patchwork Thu Feb 23 15:56:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 94386 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp277605qgi; Thu, 23 Feb 2017 08:03:34 -0800 (PST) X-Received: by 10.99.135.200 with SMTP id i191mr35245192pge.157.1487865814391; Thu, 23 Feb 2017 08:03:34 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si4657214pli.318.2017.02.23.08.03.34; Thu, 23 Feb 2017 08:03:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751156AbdBWQDd (ORCPT + 7 others); Thu, 23 Feb 2017 11:03:33 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:35761 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750828AbdBWQDc (ORCPT ); Thu, 23 Feb 2017 11:03:32 -0500 Received: by mail-ot0-f193.google.com with SMTP id y13so3879461oty.2; Thu, 23 Feb 2017 08:03:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ud4AGxdP2RT/K38UO7P+TUPKIN2xz7CpdhLLc9XvdtM=; b=r5w4KcH3wJn+luHYUZQxG+b5Zmk7/ebjnULZ3uS4Na/9AIacV/sGdpnEtB7ykhmABq 40cW0rJA0pPrUsoc91Kg9hTbItvxSRsFPk3yN5CzG08Nb1cOYRokJfNBfjNiDozPmAFi 4thkO3wdf/+7VmGZKPytK+xcHCK6CW/Pf6UadQ56YOM+xax4hOIk/Io5ZtQUVIjOwJdX sB7a4CCriwyobCdILxMrjTJp+VYeJmjThuQ5VawkpE6G7VopdI2YxN1QOc6D/FUmUO1o sUYTRR7+khpELllGmPwyGQSlAZEIf/37LBNiRIjKVOMxCrjq8vmhI2gEmXznqgEZ816n s9+Q== X-Gm-Message-State: AMke39nzLSqiuCtYjrzS+GCMdi6OORtDNw4QFs+TjQ13GL5vTl89a8lx7WeDIj0hsPVgZw== X-Received: by 10.157.43.82 with SMTP id f18mr12036848otd.79.1487865405444; Thu, 23 Feb 2017 07:56:45 -0800 (PST) Received: from rob-hp-laptop.herring.priv (66-90-148-125.dyn.grandenetworks.net. [66.90.148.125]) by smtp.googlemail.com with ESMTPSA id e61sm1693620otb.42.2017.02.23.07.56.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Feb 2017 07:56:44 -0800 (PST) From: Rob Herring To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Whitcroft , Joe Perches Subject: [PATCH] checkpatch.pl: Add SPDX license tag check for dts files and headers Date: Thu, 23 Feb 2017 09:56:44 -0600 Message-Id: <20170223155644.24213-1-robh@kernel.org> X-Mailer: git-send-email 2.10.1 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add a check for using SPDX-License-Identifier tags to define the license of .dts{i} and DT header files rather than using free form license text. This check looks for GPL, BSD, or X11(really incorrectly labeled MIT license) license text which are the commonly used DT licenses. Signed-off-by: Rob Herring Cc: Andy Whitcroft Cc: Joe Perches --- scripts/checkpatch.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.10.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 982c52ca6473..ce802b3146e3 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2139,6 +2139,7 @@ sub process { my $commit_log_has_diff = 0; my $reported_maintainer_file = 0; my $non_utf8_charset = 0; + my $licensefile = ''; my $last_blank_line = 0; my $last_coalesced_string_linenr = -1; @@ -2805,6 +2806,18 @@ sub process { } } +# check for using SPDX tag instead of free form license text in dts and binding header files + if ($licensefile ne $realfile && + ($realfile =~ /\.dtsi?$/ || $realfile =~ /dt-bindings\/.*\.h$/) && + $rawline !~ /\bSPDX-License-Identifier/ && + ($rawline =~ /^\+.*\bGeneral\s+Public\s+License/i || + $rawline =~ /^\+.*\bTHE\s+SOFTWARE\s+IS\s+PROVIDED\s+\"AS\s+IS\"/i || + $rawline =~ /^\+.*\b(GPL|BSD|X11)/)) { + $licensefile = $realfile; + WARN("SPDX_LICENSE_TAG", + "Use SPDX-License-Identifier tags instead of full license text\n" . $herecurr); + } + # check we are in a valid source file if not then ignore this hunk next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/);