aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-07-03 18:05:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:07:44 -0400
commit36ec19390effc9131132901e8a66a071a7b74a88 (patch)
treea0b823311ee76f1ffc4c2b84f9d35446fc449272
parenta605e32ebde25dc31f943fecb30e3e28079ccd06 (diff)
checkpatch: warn on comparisons to jiffies
Comparing jiffies is almost always wrong and time_before and time_after should be used instead. Warn on any comparison to jiffies. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rwxr-xr-xscripts/checkpatch.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 576139a508a3..c274e1dc1e67 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3299,6 +3299,12 @@ sub process {
3299 } 3299 }
3300 } 3300 }
3301 3301
3302# check for comparisons of jiffies
3303 if ($line =~ /\bjiffies\s*$Compare|$Compare\s*jiffies\b/) {
3304 WARN("JIFFIES_COMPARISON",
3305 "Comparing jiffies is almost always wrong; prefer time_after, time_before and friends\n" . $herecurr);
3306 }
3307
3302# warn about #ifdefs in C files 3308# warn about #ifdefs in C files
3303# if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { 3309# if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
3304# print "#ifdef in C files should be avoided\n"; 3310# print "#ifdef in C files should be avoided\n";