Commit 9d7a34a5 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

checkpatch: warn on comparisons to get_jiffies_64()

Comparing get_jiffies_64() is almost always wrong and time_before64 and
time_after64 should be used instead.

Warn on any comparison to get_jiffies_64().
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 36ec1939
...@@ -3305,6 +3305,12 @@ sub process { ...@@ -3305,6 +3305,12 @@ sub process {
"Comparing jiffies is almost always wrong; prefer time_after, time_before and friends\n" . $herecurr); "Comparing jiffies is almost always wrong; prefer time_after, time_before and friends\n" . $herecurr);
} }
# check for comparisons of get_jiffies_64()
if ($line =~ /\bget_jiffies_64\s*\(\s*\)\s*$Compare|$Compare\s*get_jiffies_64\s*\(\s*\)/) {
WARN("JIFFIES_COMPARISON",
"Comparing get_jiffies_64() is almost always wrong; prefer time_after64, time_before64 and friends\n" . $herecurr);
}
# warn about #ifdefs in C files # warn about #ifdefs in C files
# if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { # if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
# print "#ifdef in C files should be avoided\n"; # print "#ifdef in C files should be avoided\n";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment