summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorGregory Bean <gbean@codeaurora.org>2011-05-02 13:50:35 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:51:43 -0700
commit05379004cc48c1d9a2b2fd6ff4e518bd92355062 (patch)
tree227f1f2fbb2fc829e5eb0f7b3a0517466158ce42 /scripts/checkpatch.pl
parente446047078933394c3f2fb206f4991dbf2f7b27b (diff)
checkpatch: forbid implied-barrier I/O functions.
Forbid read[bwl], write[bwl], in[bwl], and out[bwl], as they contain a 'stealth barrier' which can harm performance. Developers are expected to call appropriate __raw_* or *_relaxed APIs and manage barriers explicitly. Change-Id: Ie4da221c91a0505917199db9e2fdb704c3e47d44 Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit 032fd4ba09e195d9913c08f460130da9905936ef) Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0367e22008d8..f59113732720 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4930,6 +4930,26 @@ sub process {
$herecurr);
}
+# read[bwl] & write[bwl] use too many barriers, use the _relaxed variants
+ if ($line =~ /\b((?:read|write)[bwl])\b/) {
+ ERROR("NON_RELAXED_IO",
+ "Use of $1 is deprecated: use $1_relaxed\n\t" .
+ "with appropriate memory barriers instead.\n" .
+ $herecurr);
+ }
+
+# likewise, in/out[bwl] should be __raw_read/write[bwl]...
+ if ($line =~ /\b((in|out)([bwl]))\b/) {
+ my ($all, $pref, $suf) = ($1, $2, $3);
+ $pref =~ s/in/read/;
+ $pref =~ s/out/write/;
+ ERROR("NON_RELAXED_IO",
+ "Use of $all is deprecated: use " .
+ "__raw_$pref$suf\n\t" .
+ "with appropriate memory barriers instead.\n" .
+ $herecurr);
+ }
+
# warn about #if 0
if ($line =~ /^.\s*\#\s*if\s+0\b/) {
WARN("IF_0",