On Tue, 2015-04-07 at 14:47 +0100, Juri Lelli wrote:
> how about we add also something like this to checkpatch?

[]

> Production kernels will scream if trace_printk() is used (thanks to
> Rostedt's banner). Rather than waiting for that to happen, let's check
> patches beforehand.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3257,6 +3257,12 @@ sub process {
>                            "Prefer printk_ratelimited or 
> pr_<level>_ratelimited to printk_ratelimit\n" . $herecurr);
>               }
>  
> +# check for uses of trace_printk
> +             if ($line =~ /\btrace_printk\s*\(/) {
> +                     ERROR("TRACE_PRINTK",
> +                           "Never use trace_printk in production code!\n" . 
> $herecurr);
> +             }

OK by me with a couple Nits:

o Please add a test for $realfile !~ m@kernel/trace/@
  or maybe $realfile !~ /(?:trace|tracing)/
o ERROR seems a bit strong, WARN is probably good enough


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to