mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* checkpatch: kstrtol fix
@ 2012-05-02 15:10 Joe Korty
  2012-05-02 16:13 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Korty @ 2012-05-02 15:10 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: joe.korty, linux-kernel

kstrtol is a substitute for simple_strtol() only when when second
arg of simple_strtol() is NULL. For any other value the functionality
of simple_strtol() cannot be implemented in terms of kstrtol.

So modify checkpatch.pl so that it prints out the following warning only
if the second argument is null:

   WARNING: simple_strtol is obsolete, use kstrtol instead

Signed-off-by: Joe Korty <joe.korty@ccur.com>

Index: linux/scripts/checkpatch.pl
===================================================================
--- linux.orig/scripts/checkpatch.pl	2012-05-02 10:38:45.000000000 -0400
+++ linux/scripts/checkpatch.pl	2012-05-02 10:47:58.000000000 -0400
@@ -3359,8 +3359,8 @@
 			     "consider using a completion\n" . $herecurr);
 		}
 
-# recommend kstrto* over simple_strto* and strict_strto*
-		if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) {
+# recommend kstrto* over simple_strto* and strict_strto* where appropriate
+		if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\([^,]+,\s*NULL\s*,/) {
 			WARN("CONSIDER_KSTRTO",
 			     "$1 is obsolete, use k$3 instead\n" . $herecurr);
 		}

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

end of thread, other threads:[~2012-05-02 17:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-02 15:10 checkpatch: kstrtol fix Joe Korty
2012-05-02 16:13 ` Guenter Roeck
2012-05-02 17:13   ` Joe Korty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome