All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] checkpatch: validate MODULE_LICENSE content
Date: Mon, 06 Apr 2015 17:17:02 -0700	[thread overview]
Message-ID: <1428365822.20888.11.camel@perches.com> (raw)
In-Reply-To: <1428345795-28255-1-git-send-email-bjorn.andersson@sonymobile.com>

On Mon, 2015-04-06 at 11:43 -0700, Bjorn Andersson wrote:
> There is a well defined list of expected values for MODULE_LICENSE so
> warn the user upon usage of unknown values.

Hello Bjorn

A few nits:

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -5354,6 +5354,22 @@ sub process {
>  				}
>  			}
>  		}
> +
> +		if ($line =~ /MODULE_LICENSE\(($String)\)/) {

As there are uses with spaces, this would be better as:

		if ($line =~ /\bMODULE_LICENSE\s*\(\s*($String)\s*\)/) {

> +			my $extracted_string = get_quoted_string($line, $rawline);
> +			my $valid_licenses = qr{
> +						GPL|
> +						GPL\ v2|
> +						GPL\ and\ additional\ rights|
> +						Dual\ BSD/GPL|
> +						Dual\ MIT/GPL|
> +						Dual\ MPL/GPL|
> +						Proprietary

Why add "Proprietary" ?

This is the list I get in the current tree:
(after collapsing spaces in a few places)

   5920 MODULE_LICENSE("GPL")
   1211 MODULE_LICENSE("GPL v2")
    187 MODULE_LICENSE("Dual BSD/GPL")
     37 MODULE_LICENSE("GPL and additional rights")
     26 MODULE_LICENSE("Dual MPL/GPL")
      1 MODULE_LICENSE("Dual MIT/GPL")
      1 MODULE_LICENSE("BSD")

> +					}x;
> +			if ($extracted_string !~ /^"(?:$valid_licenses)"$/x) {
> +				WARN("MODULE_LICENSE", "unknown module license " . $extracted_string . "\n" . $herecurr);

I'd write this on 2 lines in the same fashion as
all the other warnings:

				WARN("MODULE_LICENSE",
				     "unknown module license $extracted_string\n" . $herecurr);

Other than those minor issues, it seems sensible enough.

thanks,  Joe


  reply	other threads:[~2015-04-07  0:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-06 18:43 [PATCH] checkpatch: validate MODULE_LICENSE content Bjorn Andersson
2015-04-07  0:17 ` Joe Perches [this message]
2015-04-07 19:37   ` [PATCH v2] " Bjorn Andersson
2015-04-07 19:48     ` Joe Perches
2015-04-07 19:55       ` Bjorn Andersson
2015-04-07 20:16         ` Andrew Morton
2015-06-09 12:11           ` Michal Simek
2015-06-09 14:57             ` Joe Perches

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=1428365822.20888.11.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=linux-kernel@vger.kernel.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.