linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: warn about using CONFIG_EXPERIMENTAL
@ 2012-11-12 22:50 Kees Cook
  2012-11-12 23:06 ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2012-11-12 22:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andy Whitcroft, Joe Perches

This config item has not carried much meaning for a while now and is
almost always enabled by default. As agreed during the Linux kernel
summit, it is being removed.  This will discourage future addition of
CONFIG_EXPERIMENTAL while it is being phased out.

Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 scripts/checkpatch.pl |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f18750e..41e364b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1757,6 +1757,15 @@ sub process {
 			#print "is_start<$is_start> is_end<$is_end> length<$length>\n";
 		}
 
+# discourage the addition of CONFIG_EXPERIMENTAL in Kconfig.
+		if ($realfile =~ /Kconfig/ &&
+		    $line =~ /.\s*depends on\s+.*\bEXPERIMENTAL\b/) {
+			WARN("CONFIG_EXPERIMENTAL",
+			     "Use of CONFIG_EXPERIMENTAL is deprecated. " +
+			     "For alternatives, see " +
+			     "https://lkml.org/lkml/2012/10/23/580\n");
+		}
+
 		if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
 		    ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
 			my $flag = $1;
@@ -1912,6 +1921,14 @@ sub process {
 # check we are in a valid C source file if not then ignore this hunk
 		next if ($realfile !~ /\.(h|c)$/);
 
+# discourage the addition of CONFIG_EXPERIMENTAL in #if(def).
+		if ($line =~ /^\+\s*\#\s*if.*\bCONFIG_EXPERIMENTAL\b/) {
+			WARN("CONFIG_EXPERIMENTAL",
+			     "Use of CONFIG_EXPERIMENTAL is deprecated. " +
+			     "For alternatives, see " +
+			     "https://lkml.org/lkml/2012/10/23/580\n");
+		}
+
 # check for RCS/CVS revision markers
 		if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|)/) {
 			WARN("CVS_KEYWORD",
-- 
1.7.9.5


-- 
Kees Cook
Chrome OS Security

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: warn about using CONFIG_EXPERIMENTAL
  2012-11-12 22:50 [PATCH] checkpatch: warn about using CONFIG_EXPERIMENTAL Kees Cook
@ 2012-11-12 23:06 ` Joe Perches
  2012-11-12 23:11   ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2012-11-12 23:06 UTC (permalink / raw)
  To: Kees Cook; +Cc: linux-kernel, Andy Whitcroft, Andrew Morton

On Mon, 2012-11-12 at 14:50 -0800, Kees Cook wrote:
> This config item has not carried much meaning for a while now and is
> almost always enabled by default. As agreed during the Linux kernel
> summit, it is being removed.  This will discourage future addition of
> CONFIG_EXPERIMENTAL while it is being phased out.

You should also cc Andrew Morton (cc'd)

> Cc: Andy Whitcroft <apw@canonical.com>
> Cc: Joe Perches <joe@perches.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  scripts/checkpatch.pl |   17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index f18750e..41e364b 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1757,6 +1757,15 @@ sub process {
>  			#print "is_start<$is_start> is_end<$is_end> length<$length>\n";
>  		}
>  
> +# discourage the addition of CONFIG_EXPERIMENTAL in Kconfig.
> +		if ($realfile =~ /Kconfig/ &&
> +		    $line =~ /.\s*depends on\s+.*\bEXPERIMENTAL\b/) {

This is after the deleted lines check so this won't trigger
on deleted lines.

> +			WARN("CONFIG_EXPERIMENTAL",
> +			     "Use of CONFIG_EXPERIMENTAL is deprecated. " +
> +			     "For alternatives, see " +
> +			     "https://lkml.org/lkml/2012/10/23/580\n");

I'd much prefer this be on a single line and not using the +
string operator as that style is not currently used in checkpatch.

> +		}
> +
>  		if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
>  		    ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
>  			my $flag = $1;
> @@ -1912,6 +1921,14 @@ sub process {
>  # check we are in a valid C source file if not then ignore this hunk
>  		next if ($realfile !~ /\.(h|c)$/);
>  
> +# discourage the addition of CONFIG_EXPERIMENTAL in #if(def).
> +		if ($line =~ /^\+\s*\#\s*if.*\bCONFIG_EXPERIMENTAL\b/) {

Same as previous reply just a few minutes ago

There are many config uses like:
        #if defined(CONFIG_FOO)
and
        #if defined CONFIG_FOO || defined CONFIG_BAR

so I think any line that has this specific config option is suspect.
> +			WARN("CONFIG_EXPERIMENTAL",
> +			     "Use of CONFIG_EXPERIMENTAL is deprecated. " +
> +			     "For alternatives, see " +
> +			     "https://lkml.org/lkml/2012/10/23/580\n");
> +		}




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: warn about using CONFIG_EXPERIMENTAL
  2012-11-12 23:06 ` Joe Perches
@ 2012-11-12 23:11   ` Kees Cook
  2012-11-12 23:19     ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2012-11-12 23:11 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel, Andy Whitcroft, Andrew Morton

On Mon, Nov 12, 2012 at 3:06 PM, Joe Perches <joe@perches.com> wrote:
> On Mon, 2012-11-12 at 14:50 -0800, Kees Cook wrote:
>> This config item has not carried much meaning for a while now and is
>> almost always enabled by default. As agreed during the Linux kernel
>> summit, it is being removed.  This will discourage future addition of
>> CONFIG_EXPERIMENTAL while it is being phased out.
>
> You should also cc Andrew Morton (cc'd)
>
>> Cc: Andy Whitcroft <apw@canonical.com>
>> Cc: Joe Perches <joe@perches.com>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> ---
>>  scripts/checkpatch.pl |   17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index f18750e..41e364b 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -1757,6 +1757,15 @@ sub process {
>>                       #print "is_start<$is_start> is_end<$is_end> length<$length>\n";
>>               }
>>
>> +# discourage the addition of CONFIG_EXPERIMENTAL in Kconfig.
>> +             if ($realfile =~ /Kconfig/ &&
>> +                 $line =~ /.\s*depends on\s+.*\bEXPERIMENTAL\b/) {
>
> This is after the deleted lines check so this won't trigger
> on deleted lines.

Correct -- I don't want to trigger on deleted lines. That's what we
want to see in patches. :)

>> +                     WARN("CONFIG_EXPERIMENTAL",
>> +                          "Use of CONFIG_EXPERIMENTAL is deprecated. " +
>> +                          "For alternatives, see " +
>> +                          "https://lkml.org/lkml/2012/10/23/580\n");
>
> I'd much prefer this be on a single line and not using the +
> string operator as that style is not currently used in checkpatch.

Hah. Okay. We should exclude checkpatch.pl from the 80 character check
it warns about. ;)

>> +             }
>> +
>>               if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
>>                   ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
>>                       my $flag = $1;
>> @@ -1912,6 +1921,14 @@ sub process {
>>  # check we are in a valid C source file if not then ignore this hunk
>>               next if ($realfile !~ /\.(h|c)$/);
>>
>> +# discourage the addition of CONFIG_EXPERIMENTAL in #if(def).
>> +             if ($line =~ /^\+\s*\#\s*if.*\bCONFIG_EXPERIMENTAL\b/) {
>
> Same as previous reply just a few minutes ago
>
> There are many config uses like:
>         #if defined(CONFIG_FOO)
> and
>         #if defined CONFIG_FOO || defined CONFIG_BAR

Right, this will catch those. "if.*" above

> so I think any line that has this specific config option is suspect.
>> +                     WARN("CONFIG_EXPERIMENTAL",
>> +                          "Use of CONFIG_EXPERIMENTAL is deprecated. " +
>> +                          "For alternatives, see " +
>> +                          "https://lkml.org/lkml/2012/10/23/580\n");
>> +             }
>
>
>

Thanks!

-Kees

-- 
Kees Cook
Chrome OS Security

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: warn about using CONFIG_EXPERIMENTAL
  2012-11-12 23:11   ` Kees Cook
@ 2012-11-12 23:19     ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2012-11-12 23:19 UTC (permalink / raw)
  To: Kees Cook; +Cc: linux-kernel, Andy Whitcroft, Andrew Morton

On Mon, 2012-11-12 at 15:11 -0800, Kees Cook wrote:
> On Mon, Nov 12, 2012 at 3:06 PM, Joe Perches <joe@perches.com> wrote:
> > On Mon, 2012-11-12 at 14:50 -0800, Kees Cook wrote:
> >> +                     WARN("CONFIG_EXPERIMENTAL",
> >> +                          "Use of CONFIG_EXPERIMENTAL is deprecated. " +
> >> +                          "For alternatives, see " +
> >> +                          "https://lkml.org/lkml/2012/10/23/580\n");
> >
> > I'd much prefer this be on a single line and not using the +
> > string operator as that style is not currently used in checkpatch.
> 
> Hah. Okay. We should exclude checkpatch.pl from the 80 character check
> it warns about. ;)

;)

checkpatch is for .[ch] files, it isn't for anything else really.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-11-12 23:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-12 22:50 [PATCH] checkpatch: warn about using CONFIG_EXPERIMENTAL Kees Cook
2012-11-12 23:06 ` Joe Perches
2012-11-12 23:11   ` Kees Cook
2012-11-12 23:19     ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).