From 37581c28e9e77f44a3124ebab99b98643bda1aa2 Mon Sep 17 00:00:00 2001 From: Bruce Allan Date: Thu, 21 Feb 2013 16:44:19 -0800 Subject: 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 Cc: Andy Whitcroft Cc: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/checkpatch.pl') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 7b40a3f729a..747bcd768da 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3253,9 +3253,9 @@ sub process { } # prefer usleep_range over udelay - if ($line =~ /\budelay\s*\(\s*(\w+)\s*\)/) { + if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) { # ignore udelay's < 10, however - if (! (($1 =~ /(\d+)/) && ($1 < 10)) ) { + if (! ($1 < 10) ) { CHK("USLEEP_RANGE", "usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $line); } -- cgit v1.2.3-70-g09d2