X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=scripts%2Fcheckpatch.pl;h=2039acdf51222b3961b06291d6a02f4a8105a240;hb=16cdc628c3aed47d02205135b7e2f01e0064f566;hp=2018f4349b477ba3eac5d370c1efd5d99c39a1df;hpb=8bbea968f9022c3f66a36902509574597611be99;p=cascardo%2Flinux.git diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2018f4349b47..2039acdf5122 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -558,6 +558,9 @@ sub ctx_statement_block { $type = ($level != 0)? '{' : ''; if ($level == 0) { + if (substr($blk, $off + 1, 1) eq ';') { + $off++; + } last; } } @@ -2584,6 +2587,21 @@ sub process { } } +# prefer usleep_range over udelay + if ($line =~ /\budelay\s*\(\s*(\w+)\s*\)/) { + # ignore udelay's < 10, however + if (! (($1 =~ /(\d+)/) && ($1 < 10)) ) { + CHK("usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $line); + } + } + +# warn about unexpectedly long msleep's + if ($line =~ /\bmsleep\s*\((\d+)\);/) { + if ($1 < 20) { + WARN("msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt\n" . $line); + } + } + # warn about #ifdefs in C files # if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { # print "#ifdef in C files should be avoided\n";