From f34ff8348751edfff5de2e4cc5acbce6745af5a3 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 30 Jul 2012 14:41:20 -0700 Subject: [PATCH] --- yaml --- r: 319938 b: refs/heads/master c: 4a273195a551a27a9a3ebed072c8df16c853da7f h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/scripts/checkpatch.pl | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 8d73cca48952..79643d56e4d1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ce0338df3c9a43e709b8a478265b32b9edcc7ccc +refs/heads/master: 4a273195a551a27a9a3ebed072c8df16c853da7f diff --git a/trunk/scripts/checkpatch.pl b/trunk/scripts/checkpatch.pl index 3e04f80375de..4bad5700670a 100755 --- a/trunk/scripts/checkpatch.pl +++ b/trunk/scripts/checkpatch.pl @@ -3313,6 +3313,22 @@ sub process { } } +# check usleep_range arguments + if ($^V && $^V ge 5.10.0 && + defined $stat && + $stat =~ /^\+(?:.*?)\busleep_range\s*\(\s*($FuncArg)\s*,\s*($FuncArg)\s*\)/) { + my $min = $1; + my $max = $7; + if ($min eq $max) { + WARN("USLEEP_RANGE", + "usleep_range should not use min == max args; see Documentation/timers/timers-howto.txt\n" . "$here\n$stat\n"); + } elsif ($min =~ /^\d+$/ && $max =~ /^\d+$/ && + $min > $max) { + WARN("USLEEP_RANGE", + "usleep_range args reversed, use min then max; see Documentation/timers/timers-howto.txt\n" . "$here\n$stat\n"); + } + } + # check for new externs in .c files. if ($realfile =~ /\.c$/ && defined $stat && $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)