Skip to content

Commit

Permalink
checkpatch: check for __smp outside barrier.h
Browse files Browse the repository at this point in the history
Introduction of __smp barriers cleans up a bunch of duplicate code, but
it gives people an additional handle onto a "new" set of barriers - just
because they're prefixed with __* unfortunately doesn't stop anyone from
using it (as happened with other arch stuff before.)

Add a checkpatch test so it will trigger a warning.

Reported-by: Russell King <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Acked-by: Julian Calaby <[email protected]>
Acked-by: Joe Perches <[email protected]>
Acked-by: Peter Zijlstra (Intel) <[email protected]>
  • Loading branch information
mstsirkin committed Jan 12, 2016
1 parent 402c255 commit f4073b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5143,6 +5143,16 @@ sub process {
}
}

my $underscore_smp_barriers = qr{__smp_(?:$barrier_stems)}x;

if ($realfile !~ m@^include/asm-generic/@ &&
$realfile !~ m@/barrier\.h$@ &&
$line =~ m/\b(?:$underscore_smp_barriers)\s*\(/ &&
$line !~ m/^.\s*\#\s*define\s+(?:$underscore_smp_barriers)\s*\(/) {
WARN("MEMORY_BARRIER",
"__smp memory barriers shouldn't be used outside barrier.h and asm-generic\n" . $herecurr);
}

# check for waitqueue_active without a comment.
if ($line =~ /\bwaitqueue_active\s*\(/) {
if (!ctx_has_comment($first_line, $linenr)) {
Expand Down

0 comments on commit f4073b0

Please sign in to comment.