From: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Andy Whitcroft <apw-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH] checkpatch.pl: Add SPDX license tag check for dts files and headers
Date: Thu, 23 Feb 2017 09:56:44 -0600 [thread overview]
Message-ID: <20170223155644.24213-1-robh@kernel.org> (raw)
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 <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Andy Whitcroft <apw-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Cc: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
---
scripts/checkpatch.pl | 13 +++++++++++++
1 file changed, 13 insertions(+)
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)$/);
--
2.10.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robh@kernel.org>
To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>
Subject: [PATCH] checkpatch.pl: Add SPDX license tag check for dts files and headers
Date: Thu, 23 Feb 2017 09:56:44 -0600 [thread overview]
Message-ID: <20170223155644.24213-1-robh@kernel.org> (raw)
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 <robh@kernel.org>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 13 +++++++++++++
1 file changed, 13 insertions(+)
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)$/);
--
2.10.1
next reply other threads:[~2017-02-23 15:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-23 15:56 Rob Herring [this message]
2017-02-23 15:56 ` [PATCH] checkpatch.pl: Add SPDX license tag check for dts files and headers Rob Herring
2017-02-23 17:51 ` Joe Perches
[not found] ` <1487872274.14159.36.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2017-02-23 18:45 ` Rob Herring
2017-02-23 18:45 ` Rob Herring
[not found] ` <CAL_JsqL4ZztUvSevr4Co55n6w10TZaydGDyp4HJxHszFNvkVxw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-23 19:10 ` Joe Perches
2017-02-23 19:10 ` Joe Perches
2017-06-07 8:45 ` Masahiro Yamada
[not found] ` <CAK7LNASGzmF_WctWVJRQN_Ko7aOeXbwh6KHujKw1J-LAhvGQ2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-09 13:56 ` Rob Herring
2017-06-09 13:56 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170223155644.24213-1-robh@kernel.org \
--to=robh-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=apw-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.