diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2b3c22808c3b..94b4e33fa532 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -5116,7 +5116,27 @@ sub process { | |||
5116 | } | 5116 | } |
5117 | } | 5117 | } |
5118 | # check for memory barriers without a comment. | 5118 | # check for memory barriers without a comment. |
5119 | if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) { | 5119 | |
5120 | my $barriers = qr{ | ||
5121 | mb| | ||
5122 | rmb| | ||
5123 | wmb| | ||
5124 | read_barrier_depends | ||
5125 | }x; | ||
5126 | my $barrier_stems = qr{ | ||
5127 | mb__before_atomic| | ||
5128 | mb__after_atomic| | ||
5129 | store_release| | ||
5130 | load_acquire| | ||
5131 | store_mb| | ||
5132 | (?:$barriers) | ||
5133 | }x; | ||
5134 | my $all_barriers = qr{ | ||
5135 | (?:$barriers)| | ||
5136 | smp_(?:$barrier_stems) | ||
5137 | }x; | ||
5138 | |||
5139 | if ($line =~ /\b(?:$all_barriers)\s*\(/) { | ||
5120 | if (!ctx_has_comment($first_line, $linenr)) { | 5140 | if (!ctx_has_comment($first_line, $linenr)) { |
5121 | WARN("MEMORY_BARRIER", | 5141 | WARN("MEMORY_BARRIER", |
5122 | "memory barrier without comment\n" . $herecurr); | 5142 | "memory barrier without comment\n" . $herecurr); |