[PATCH -next v2] rv/include: set variable 'da_mon_##name' to static

Yu Liao posted 1 patch 2 years, 3 months ago
include/rv/da_monitor.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH -next v2] rv/include: set variable 'da_mon_##name' to static
Posted by Yu Liao 2 years, 3 months ago
gcc with W=1 reports
kernel/trace/rv/monitors/wip/wip.c:20:1: sparse: sparse: symbol 'da_mon_wip' was not declared. Should it be static?

The per-cpu variable 'da_mon_##name' is only used in its defining file, so
it should be static.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202307280030.7EjUG9gR-lkp@intel.com/
Signed-off-by: Yu Liao <liaoyu15@huawei.com>
---
v1 -> v2: fix the backslash 
---
 include/rv/da_monitor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h
index 9eb75683e012..9705b2a98e49 100644
--- a/include/rv/da_monitor.h
+++ b/include/rv/da_monitor.h
@@ -262,7 +262,7 @@ static inline void da_monitor_destroy_##name(void)						\
 /*												\
  * per-cpu monitor variables									\
  */												\
-DEFINE_PER_CPU(struct da_monitor, da_mon_##name);						\
+static DEFINE_PER_CPU(struct da_monitor, da_mon_##name);					\
 												\
 /*												\
  * da_get_monitor_##name - return current CPU monitor address					\
-- 
2.25.1
Re: [PATCH -next v2] rv/include: set variable 'da_mon_##name' to static
Posted by Daniel Bristot de Oliveira 2 years, 3 months ago
On 8/23/23 04:00, Yu Liao wrote:
> gcc with W=1 reports
> kernel/trace/rv/monitors/wip/wip.c:20:1: sparse: sparse: symbol 'da_mon_wip' was not declared. Should it be static?
> 
> The per-cpu variable 'da_mon_##name' is only used in its defining file, so
> it should be static.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202307280030.7EjUG9gR-lkp@intel.com/
> Signed-off-by: Yu Liao <liaoyu15@huawei.com>

Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>

Thanks!
-- Daniel