Skip to content

Commit 37581c2

Browse files
bwallantorvalds
authored andcommitted
checkpatch: fix USLEEP_RANGE test
Do not test udelay() for a value less than 10usec when passed a variable instead of a hard-coded number; there is no way for checkpatch to know the value of the variable. As it is today, it will complain about variables with alphanumeric characters plus '_', e.g. foo_bar, but not variables with other characters, eg. foo->bar. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5ce59ae commit 37581c2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎scripts/checkpatch.pl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3253,9 +3253,9 @@ sub process {
32533253
}
32543254

32553255
# prefer usleep_range over udelay
3256-
if ($line =~ /\budelay\s*\(\s*(\w+)\s*\)/) {
3256+
if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) {
32573257
# ignore udelay's < 10, however
3258-
if (! (($1 =~ /(\d+)/) && ($1 < 10)) ) {
3258+
if (! ($1 < 10) ) {
32593259
CHK("USLEEP_RANGE",
32603260
"usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $line);
32613261
}

0 commit comments

Comments
 (0)