[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1253585691-10987-5-git-send-email-dwalker@fifo99.com>
Date: Mon, 21 Sep 2009 19:14:51 -0700
From: Daniel Walker <dwalker@...o99.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Whitcroft <apw@...onical.com>, linux-kernel@...r.kernel.org,
Daniel Walker <dwalker@...o99.com>,
Ingo Molnar <mingo@...e.hu>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Subject: [PATCH 5/5] checkpatch: fix false EXPORT_SYMBOL warning
Ingo reported that the following lines triggered a false warning,
static struct lock_class_key rcu_lock_key;
struct lockdep_map rcu_lock_map =
STATIC_LOCKDEP_MAP_INIT("rcu_read_lock", &rcu_lock_key);
EXPORT_SYMBOL_GPL(rcu_lock_map);
from kernel/rcutree.c , and the false warning looked like this,
WARNING: EXPORT_SYMBOL(foo); should immediately follow its
function/variable
+EXPORT_SYMBOL_GPL(rcu_lock_map);
This change corrects this. It was caused because checkpatch doesn't check
more than one line above the "EXPORT_SYMBOL" for additional context (ie.
variable name, or initializer). Things are somewhat more complicated
because STATIC_LOCKDEP_MAP_INIT() doesn't accept the variable name that
is being initialized. I just added another check that checks two lines
above "EXPORT_SYMBOL" for the variable declaration.
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Signed-off-by: Daniel Walker <dwalker@...o99.com>
---
scripts/checkpatch.pl | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index fd4fe03..9996bfb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1629,7 +1629,7 @@ sub process {
# check for initialisation to aggregates open brace on the next line
if (($prevline =~ /$Declare\s*$Ident\s*=\s*$/ || $prevline =~ /$Attribute\s*=\s*$/) &&
- $line =~ /^.\s*{/) {
+ $line =~ /^.\s*{/) {
ERROR("that open brace { should be on the previous line\n" . $hereprev);
}
@@ -1665,7 +1665,9 @@ sub process {
^.LIST_HEAD\(\Q$name\E\)|
^.$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(|
\b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[)
- )/x) {
+ )/x && defined $lines[$linenr - 3] &&
+ $lines[$linenr - 3] !~ /(?:\b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[))/
+ ) {
WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr);
}
}
--
1.5.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists