Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a15a250 authored by Patrick Pannuto's avatar Patrick Pannuto Committed by Linus Torvalds
Browse files

checkpatch: prefer usleep_range over udelay



When possible, sleeping is (usually) better than delaying; however, don't
bother callers of udelay < 10us, as those cases are generally not worth
the switch to usleep

[akpm@linux-foundation.org: fix mismatched parentheses]
Signed-off-by: default avatarPatrick Pannuto <ppannuto@codeaurora.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8bbea968
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -2584,6 +2584,14 @@ 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 #ifdefs in C files
# warn about #ifdefs in C files
#		if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
#		if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
#			print "#ifdef in C files should be avoided\n";
#			print "#ifdef in C files should be avoided\n";