* [PATCH] checkpatch: check proper licensing of Devicetree bindings
@ 2020-03-09 21:51 Lubomir Rintel
2020-03-09 22:06 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Lubomir Rintel @ 2020-03-09 21:51 UTC (permalink / raw)
To: Joe Perches; +Cc: Andy Whitcroft, linux-kernel, Lubomir Rintel
According to Devicetree maintainers (see Link: below), the Devicetree
binding documents are preferrably licensed (GPL-2.0-only OR
BSD-2-Clause).
Let's check that. The actual check is a bit more relaxed, to allow more
liberal but compatible licensing (e.g. GPL-2.0-or-later OR
BSD-2-Clause).
Link: https://lore.kernel.org/lkml/20200108142132.GA4830@bogus/
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
Changes since v1:
- Downgrade severity to CHECK when running against existing files [Joe
Perches]
- Add --fix support [Joe Perches]
Both changes are taken from here: https://lore.kernel.org/lkml/39042657067088e4ca960f630a7d222fc48f947a.camel@perches.com/
---
scripts/checkpatch.pl | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e2976c3fe5ff8..642e897f46e5c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3111,6 +3111,17 @@ sub process {
WARN("SPDX_LICENSE_TAG",
"'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
}
+ if ($realfile =~ m@^Documentation/devicetree/bindings/@ &&
+ not $spdx_license =~ /GPL-2\.0.*BSD-2-Clause/) {
+ my $msg_level = \&WARN;
+ $msg_level = \&CHK if ($file);
+ if (&{$msg_level}("SPDX_LICENSE_TAG",
+
+ "DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause)\n" . $herecurr) &&
+ $fix) {
+ $fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)/;
+ }
+ }
}
}
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch: check proper licensing of Devicetree bindings
2020-03-09 21:51 [PATCH] checkpatch: check proper licensing of Devicetree bindings Lubomir Rintel
@ 2020-03-09 22:06 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2020-03-09 22:06 UTC (permalink / raw)
To: Lubomir Rintel, Andrew Morton; +Cc: Andy Whitcroft, linux-kernel
On Mon, 2020-03-09 at 22:51 +0100, Lubomir Rintel wrote:
> According to Devicetree maintainers (see Link: below), the Devicetree
> binding documents are preferrably licensed (GPL-2.0-only OR
> BSD-2-Clause).
>
> Let's check that. The actual check is a bit more relaxed, to allow more
> liberal but compatible licensing (e.g. GPL-2.0-or-later OR
> BSD-2-Clause).
>
> Link: https://lore.kernel.org/lkml/20200108142132.GA4830@bogus/
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Fine by me.
Andrew, please pick this up.
cheers, Joe
> ---
> Changes since v1:
> - Downgrade severity to CHECK when running against existing files [Joe
> Perches]
> - Add --fix support [Joe Perches]
> Both changes are taken from here: https://lore.kernel.org/lkml/39042657067088e4ca960f630a7d222fc48f947a.camel@perches.com/
> ---
> scripts/checkpatch.pl | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index e2976c3fe5ff8..642e897f46e5c 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3111,6 +3111,17 @@ sub process {
> WARN("SPDX_LICENSE_TAG",
> "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
> }
> + if ($realfile =~ m@^Documentation/devicetree/bindings/@ &&
> + not $spdx_license =~ /GPL-2\.0.*BSD-2-Clause/) {
> + my $msg_level = \&WARN;
> + $msg_level = \&CHK if ($file);
> + if (&{$msg_level}("SPDX_LICENSE_TAG",
> +
> + "DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause)\n" . $herecurr) &&
> + $fix) {
> + $fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)/;
> + }
> + }
> }
> }
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] checkpatch: check proper licensing of Devicetree bindings
@ 2020-01-29 12:33 Lubomir Rintel
2020-01-29 22:11 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Lubomir Rintel @ 2020-01-29 12:33 UTC (permalink / raw)
To: Andy Whitcroft
Cc: Joe Perches, Rob Herring, devicetree, linux-kernel, Lubomir Rintel
According to Devicetree maintainers (see Link: below), the Devicetree
binding documents are preferrably licensed (GPL-2.0-only OR
BSD-2-Clause).
Let's check that. The actual check is a bit more relaxed, to allow more
liberal but compatible licensing (e.g. GPL-2.0-or-later OR
BSD-2-Clause).
Link: https://lore.kernel.org/lkml/20200108142132.GA4830@bogus/
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
scripts/checkpatch.pl | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e2976c3fe5ff8..ac93e98cddcee 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3111,6 +3111,11 @@ sub process {
WARN("SPDX_LICENSE_TAG",
"'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
}
+ if ($realfile =~ m@^Documentation/devicetree/bindings/@ &&
+ not $spdx_license =~ /GPL-2\.0.*BSD-2-Clause/) {
+ WARN("SPDX_LICENSE_TAG",
+ "DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause)\n" . $herecurr);
+ }
}
}
}
--
2.24.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch: check proper licensing of Devicetree bindings
2020-01-29 12:33 Lubomir Rintel
@ 2020-01-29 22:11 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2020-01-29 22:11 UTC (permalink / raw)
To: Lubomir Rintel, Andy Whitcroft; +Cc: Rob Herring, devicetree, linux-kernel
On Wed, 2020-01-29 at 13:33 +0100, Lubomir Rintel wrote:
> According to Devicetree maintainers (see Link: below), the Devicetree
> binding documents are preferrably licensed (GPL-2.0-only OR
> BSD-2-Clause).
>
> Let's check that. The actual check is a bit more relaxed, to allow more
> liberal but compatible licensing (e.g. GPL-2.0-or-later OR
> BSD-2-Clause).
>
> Link: https://lore.kernel.org/lkml/20200108142132.GA4830@bogus/
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---
> scripts/checkpatch.pl | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index e2976c3fe5ff8..ac93e98cddcee 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3111,6 +3111,11 @@ sub process {
> WARN("SPDX_LICENSE_TAG",
> "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
> }
> + if ($realfile =~ m@^Documentation/devicetree/bindings/@ &&
> + not $spdx_license =~ /GPL-2\.0.*BSD-2-Clause/) {
> + WARN("SPDX_LICENSE_TAG",
> + "DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause)\n" . $herecurr);
I think not unless the existing licenses already
there are changed first. Only about 1/3 are
dual licensed BSD.
Do all the existing license holders agree?
$ git grep -oh "SPDX.*$" Documentation/devicetree/bindings/ | \
sort |
uniq -c | sort -rn
269 SPDX-License-Identifier: GPL-2.0
81 SPDX-
License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
69 SPDX-License-
Identifier: (GPL-2.0 OR BSD-2-Clause)
23 SPDX-License-Identifier:
GPL-2.0-only
9 SPDX-License-Identifier: GPL-2.0+
5 SPDX-
License-Identifier: GPL-2.0-or-later
3 SPDX-License-Identifier:
(GPL-2.0+ OR X11)
3 SPDX-License-Identifier: (GPL-2.0 OR MIT)
3 SPDX-License-Identifier: (GPL-2.0)
2 SPDX-License-Identifier:
GPL-2.0-or-later OR BSD-2-Clause
2 SPDX-License-Identifier: (GPL-
2.0-or-later OR BSD-2-Clause)
2 SPDX-License-Identifier: GPL-2.0 OR
BSD-2-Clause
1 SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause)
1 SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
There would be way too many false positives given
the current licensing types in existing files.
Also, the link seems to show just a desire for an
OR BSD for this file not a desire for a treewide
change.
But:
Documentation/devicetree/bindings/submitting-patches.txt does show:
3) DT binding files should be dual licensed. The preferred license tag is
(GPL-2.0-only OR BSD-2-Clause).
So perhaps use code like:
my $msg_level = \&WARN;
$msg_level = \&CHK if ($file);
if (&{$msg_level}("SPDX_LICENSE_TAG",
"The preferred bindings license is '(GPL-2.0-only OR BSD-2-Clause)'\n" . $herecurr)
so that when checkpatch is run over existing files,
this message is not emitted unless using --strict.
Maybe something like:
---
scripts/checkpatch.pl | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f3b8434..1734c9b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3124,6 +3124,17 @@ sub process {
if (!is_SPDX_License_valid($spdx_license)) {
WARN("SPDX_LICENSE_TAG",
"'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
+ }
+ if ($realfile =~ m@^Documentation/devicetree/bindings/@ &&
+ $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",
+
+ "DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause)\n" . $herecurr) &&
+ $fix) {
+ $fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)/;
+ }
}
}
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-09 22:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 21:51 [PATCH] checkpatch: check proper licensing of Devicetree bindings Lubomir Rintel
2020-03-09 22:06 ` Joe Perches
-- strict thread matches above, loose matches on Subject: below --
2020-01-29 12:33 Lubomir Rintel
2020-01-29 22:11 ` Joe Perches
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.