]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
checkpatch: warn on comparisons to get_jiffies_64()
authorJoe Perches <joe@perches.com>
Wed, 19 Jun 2013 00:07:20 +0000 (10:07 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Jun 2013 07:27:06 +0000 (17:27 +1000)
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: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
scripts/checkpatch.pl

index c274e1dc1e67d5ae0b933be1fa5f80233e1608ce..f4e247b277dec37ccc40a04fc3856049d0ece693 100755 (executable)
@@ -3305,6 +3305,12 @@ sub process {
                             "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
 #              if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
 #                      print "#ifdef in C files should be avoided\n";