Messages in this thread |  | | | Date | Wed, 30 Sep 2009 18:46:44 +0100 | | From | Andy Whitcroft <> | | Subject | Re: [PATCH 5/5] checkpatch: fix false EXPORT_SYMBOL warning |
| |
On Mon, Sep 21, 2009 at 07:14:51PM -0700, Daniel Walker wrote: > 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.
In theory the thing we are exporting can be an arbitrary number of lines prior to the EXPORT_SYMBOL statement. We actually want to look at the statement before the EXPORT_*.
I had a go at doing it this way and it seems to work on my test sets. Perhaps you could test the version at the url below:
http://www.kernel.org/pub/linux/kernel/people/apw/checkpatch/checkpatch.pl-testing
NOTE: you want at least version 0.29-5-* which is in the process of mirroring out.
-apw
|  |