From: Joe Perches Date: Wed, 3 Jul 2013 22:05:25 +0000 (-0700) Subject: checkpatch: warn on comparisons to jiffies X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=36ec19390effc9131132901e8a66a071a7b74a88;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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 { } } +# check for comparisons of jiffies + if ($line =~ /\bjiffies\s*$Compare|$Compare\s*jiffies\b/) { + WARN("JIFFIES_COMPARISON", + "Comparing jiffies is almost always wrong; prefer time_after, time_before 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";