Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2052619imm; Fri, 7 Sep 2018 10:04:45 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbLjBJmC1sdIchkeVXd32mp7TAgZhigwKiDWFRlH4HpQLr14GGwJglYBDF1qE1suWlU3Nsd X-Received: by 2002:a17:902:42a3:: with SMTP id h32-v6mr9065816pld.105.1536339885870; Fri, 07 Sep 2018 10:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536339885; cv=none; d=google.com; s=arc-20160816; b=YWdMbVRxayvfJrAA84p9oH00K2jO3N50cVjJ2BrR5WCL08FkFhGy/3wdA/oZxyFa3n ilmAz2LJCB9vrznE2OqcD8uESoj1xzyCOFod7nekqX3SjgudIDEhQ4kI5Bic106y7Rfp Ow6LyN6LEbSjev+ZnpWEmViI6k9UNU/ecj1/PkyP2O5yx7IEo/udISALBAGLCV6fV7X3 Xb4ziimtHRkNRkUzMYAwSSQp8HJdkPNlhlfYeIlacYsx0tPU2qq/lYcVUoABPGVyPcfg NBRFQCqk5vRhLnManTh5Vt7DWZeYKg7ujvMcwahohsAKeEXIAHv4+W1TxpHbP7rNX1WV LkcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=W2qGwkcvnHT6/3cOs9YHL2/ComJ7UkkhQWeFf0SvyWw=; b=G9CJK8joXHWd3rWfBX4IH/SYjMLR73DI6urrg9j+8znRZH+b5cOXA9r90PmEUV0I8R xTSfba+saCeuWz6ZgwXqkXe1tLhbWDTQyOGCK0XIQ5kNw5s6+7dS9WPExs9RuqLF0Ca/ +smPNC9pgcfYWt4HWY0JS5B+FLBWibkN2W1zBW8oGTASnfmCouPafhY44ELUyXcPFmTt 95waDrUQeuWThjRKR1v5SkSajmR3pTltXaGokqxPl8iJ0i8VTA4x52Co77NZ6b1q1m3B 0Qs2PeLkDnA7sU6ATnD+bjtqx61FXNO8RHMycsrhHm3fJNswONkM9UlPKAR4c8RlCPJJ 21vA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b39-v6si9086207plb.484.2018.09.07.10.04.29; Fri, 07 Sep 2018 10:04:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726399AbeIGVov (ORCPT + 99 others); Fri, 7 Sep 2018 17:44:51 -0400 Received: from mga07.intel.com ([134.134.136.100]:46006 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726002AbeIGVov (ORCPT ); Fri, 7 Sep 2018 17:44:51 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Sep 2018 10:03:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,343,1531810800"; d="scan'208";a="86900033" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.20]) by fmsmga004.fm.intel.com with ESMTP; 07 Sep 2018 10:02:40 -0700 Date: Fri, 7 Sep 2018 10:02:40 -0700 From: Sean Christopherson To: Joe Perches Cc: Miguel Ojeda , Jarkko Sakkinen , Andy Shevchenko , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Platform Driver , Dave Hansen , nhorman@redhat.com, npmccallum@redhat.com, linux-sgx@vger.kernel.org, serge.ayoun@intel.com, shay.katz-zamir@intel.com, "Siddha, Suresh B" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Darren Hart , Andy Shevchenko , Herbert Xu , Eric Biggers , Linux Kernel Mailing List Subject: Re: [PATCH v13 11/13] platform/x86: Intel SGX driver Message-ID: <20180907170240.GA21376@linux.intel.com> References: <20180827185507.17087-1-jarkko.sakkinen@linux.intel.com> <20180827185507.17087-12-jarkko.sakkinen@linux.intel.com> <20180905173355.GE11368@linux.intel.com> <20180906092100.GA27302@linux.intel.com> <5137f85388e26ea1ed46b34901b0f18540aee7cb.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5137f85388e26ea1ed46b34901b0f18540aee7cb.camel@perches.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 06, 2018 at 05:50:01PM -0700, Joe Perches wrote: > On Thu, 2018-09-06 at 19:35 +0200, Miguel Ojeda wrote: > > > Which one is right and why the kernel tree is polluted with C99-headers > > > when they do not pass checkpatch.pl? > > checkpatch ignores c99 headers since 2016. Jarkko was referring to c99 comments for the SPDX license. checkpatch explicitly requires c-style comments for headers and assembly files as dictated by Documentation/process/license-rules.rst. $ grep -r SPDX **/*.h | grep \/\/ | wc -l 665 $ grep -r SPDX **/*.S | grep \/\/ | wc -l 22 $ git show 9f3a89926d6df commit 9f3a89926d6dfc30a4fd1bbcb92cc7b218d3786d Author: Rob Herring Date: Tue Apr 10 16:33:13 2018 -0700 checkpatch.pl: add SPDX license tag check Add SPDX license tag check based on the rules defined in Documentation/process/license-rules.rst. To summarize, SPDX license tags should be on the 1st line (or 2nd line in scripts) using the appropriate comment style for the file type. Link: http://lkml.kernel.org/r/20180202154026.15298-1-robh@kernel.org Signed-off-by: Rob Herring Signed-off-by: Joe Perches Acked-by: Greg Kroah-Hartman Acked-by: Philippe Ombredanne Cc: Andy Whitcroft Cc: Joe Perches Cc: Thomas Gleixner Cc: Igor Stoppa Cc: Jonathan Corbet Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b464a4c3f863..0f022b56f117 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2257,6 +2257,8 @@ sub process { my $camelcase_file_seeded = 0; + my $checklicenseline = 1; + sanitise_line_reset(); my $line; foreach my $rawline (@rawlines) { @@ -2448,6 +2450,7 @@ sub process { } else { $check = $check_orig; } + $checklicenseline = 1; next; } @@ -2911,6 +2914,30 @@ sub process { } } +# check for using SPDX license tag at beginning of files + if ($realline == $checklicenseline) { + if ($rawline =~ /^[ \+]\s*\#\!\s*\//) { + $checklicenseline = 2; + } elsif ($rawline =~ /^\+/) { + my $comment = ""; + if ($realfile =~ /\.(h|s|S)$/) { + $comment = '/*'; + } elsif ($realfile =~ /\.(c|dts|dtsi)$/) { + $comment = '//'; + } elsif (($checklicenseline == 2) || $realfile =~ /\.(sh|pl|py|awk|tc)$/) { + $comment = '#'; + } elsif ($realfile =~ /\.rst$/) { + $comment = '..'; + } + + if ($comment !~ /^$/ && + $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) { + WARN("SPDX_LICENSE_TAG", + "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\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)$/);