diff options
author | Tejun Heo <tj@kernel.org> | 2013-12-04 10:12:40 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-12-05 12:59:23 -0500 |
commit | b1a0fbfdde65dffd83c84c006f84fa12041907c5 (patch) | |
tree | 5abf835511af7cc259b15b616bb9592eb2e19bd3 /include/linux/percpu-defs.h | |
parent | 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff) |
percpu: fix spurious sparse warnings from DEFINE_PER_CPU()
When CONFIG_DEBUG_FORCE_WEAK_PER_CPU or CONFIG_ARCH_NEEDS_WEAK_PER_CPU
is set, DEFINE_PER_CPU() explodes into cryptic series of definitions
to still allow using "static" for percpu variables while keeping all
per-cpu symbols unique in the kernel image which is required for weak
symbols. This ultimately converts the actual symbol to global whether
DEFINE_PER_CPU() is prefixed with static or not.
Unfortunately, the macro forgot to add explicit extern declartion of
the actual symbol ending up defining global symbol without preceding
declaration for static definitions which naturally don't have matching
DECLARE_PER_CPU(). The only ill effect is triggering of the following
warnings.
fs/inode.c:74:8: warning: symbol 'nr_inodes' was not declared. Should it be static?
fs/inode.c:75:8: warning: symbol 'nr_unused' was not declared. Should it be static?
Fix it by adding extern declaration in the DEFINE_PER_CPU() macro.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Diffstat (limited to 'include/linux/percpu-defs.h')
-rw-r--r-- | include/linux/percpu-defs.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 57e890abe1f0..a5fc7d01aad6 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h | |||
@@ -69,6 +69,7 @@ | |||
69 | __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ | 69 | __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ |
70 | extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ | 70 | extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ |
71 | __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ | 71 | __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ |
72 | extern __PCPU_ATTRS(sec) __typeof__(type) name; \ | ||
72 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ | 73 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ |
73 | __typeof__(type) name | 74 | __typeof__(type) name |
74 | #else | 75 | #else |