mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] rv/monitors: fix sparse warning about lack of static qualifier
@ 2022-08-24  3:43 Zeng Heng
  2022-08-24  3:43 ` [PATCH -next 1/2] rv/monitors: add 'static' qualifier for local symbols Zeng Heng
  2022-08-24  3:43 ` [PATCH -next 2/2] rv/dot2K: add 'static' qualifier for local variable Zeng Heng
  0 siblings, 2 replies; 5+ messages in thread
From: Zeng Heng @ 2022-08-24  3:43 UTC (permalink / raw)
  To: bristot, mingo, rostedt; +Cc: linux-kernel, zengheng4

Fix sparse tool complains about rv/monitors existing modules.

In order to prevent new modules from similar warning,
also modify the template files to avoid such warning.

Zeng Heng (2):
  rv/monitors: add 'static' qualifier for local symbols
  rv/dot2K: add 'static' qualifier for local variable

 kernel/trace/rv/monitors/wip/wip.c                      | 4 ++--
 kernel/trace/rv/monitors/wwnr/wwnr.c                    | 4 ++--
 tools/verification/dot2/dot2k_templates/main_global.c   | 4 ++--
 tools/verification/dot2/dot2k_templates/main_per_cpu.c  | 4 ++--
 tools/verification/dot2/dot2k_templates/main_per_task.c | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH -next 1/2] rv/monitors: add 'static' qualifier for local symbols
  2022-08-24  3:43 [PATCH 0/2] rv/monitors: fix sparse warning about lack of static qualifier Zeng Heng
@ 2022-08-24  3:43 ` Zeng Heng
  2022-08-24  6:33   ` Daniel Bristot de Oliveira
  2022-08-24  3:43 ` [PATCH -next 2/2] rv/dot2K: add 'static' qualifier for local variable Zeng Heng
  1 sibling, 1 reply; 5+ messages in thread
From: Zeng Heng @ 2022-08-24  3:43 UTC (permalink / raw)
  To: bristot, mingo, rostedt; +Cc: linux-kernel, zengheng4

The sparse tool complains as follows:

kernel/trace/rv/monitors/wwnr/wwnr.c:18:19:
warning: symbol 'rv_wwnr' was not declared. Should it be static?

The `rv_wwnr` symbol is not dereferenced by other extern files,
so add static qualifier for it.

So does wip module.

Fixes:	ccc319dcb450 ("rv/monitor: Add the wwnr monitor")
Fixes:	8812d21219b9 ("rv/monitor: Add the wip monitor skeleton created by dot2k")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
 kernel/trace/rv/monitors/wip/wip.c   | 4 ++--
 kernel/trace/rv/monitors/wwnr/wwnr.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/rv/monitors/wip/wip.c b/kernel/trace/rv/monitors/wip/wip.c
index 83cace53b9fa..1a989bc142f3 100644
--- a/kernel/trace/rv/monitors/wip/wip.c
+++ b/kernel/trace/rv/monitors/wip/wip.c
@@ -16,7 +16,7 @@
 
 #include "wip.h"
 
-struct rv_monitor rv_wip;
+static struct rv_monitor rv_wip;
 DECLARE_DA_MON_PER_CPU(wip, unsigned char);
 
 static void handle_preempt_disable(void *data, unsigned long ip, unsigned long parent_ip)
@@ -60,7 +60,7 @@ static void disable_wip(void)
 	da_monitor_destroy_wip();
 }
 
-struct rv_monitor rv_wip = {
+static struct rv_monitor rv_wip = {
 	.name = "wip",
 	.description = "wakeup in preemptive per-cpu testing monitor.",
 	.enable = enable_wip,
diff --git a/kernel/trace/rv/monitors/wwnr/wwnr.c b/kernel/trace/rv/monitors/wwnr/wwnr.c
index 599225d9cf38..a063b93c6a1d 100644
--- a/kernel/trace/rv/monitors/wwnr/wwnr.c
+++ b/kernel/trace/rv/monitors/wwnr/wwnr.c
@@ -15,7 +15,7 @@
 
 #include "wwnr.h"
 
-struct rv_monitor rv_wwnr;
+static struct rv_monitor rv_wwnr;
 DECLARE_DA_MON_PER_TASK(wwnr, unsigned char);
 
 static void handle_switch(void *data, bool preempt, struct task_struct *p,
@@ -59,7 +59,7 @@ static void disable_wwnr(void)
 	da_monitor_destroy_wwnr();
 }
 
-struct rv_monitor rv_wwnr = {
+static struct rv_monitor rv_wwnr = {
 	.name = "wwnr",
 	.description = "wakeup while not running per-task testing model.",
 	.enable = enable_wwnr,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH -next 2/2] rv/dot2K: add 'static' qualifier for local variable
  2022-08-24  3:43 [PATCH 0/2] rv/monitors: fix sparse warning about lack of static qualifier Zeng Heng
  2022-08-24  3:43 ` [PATCH -next 1/2] rv/monitors: add 'static' qualifier for local symbols Zeng Heng
@ 2022-08-24  3:43 ` Zeng Heng
  2022-08-24  6:33   ` Daniel Bristot de Oliveira
  1 sibling, 1 reply; 5+ messages in thread
From: Zeng Heng @ 2022-08-24  3:43 UTC (permalink / raw)
  To: bristot, mingo, rostedt; +Cc: linux-kernel, zengheng4

Following Daniel's suggestion, fix similar warning
in template files, which would prevent new monitors
from such warning.

Fixes:	24bce201d798 ("tools/rv: Add dot2k")
Suggested-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
 tools/verification/dot2/dot2k_templates/main_global.c   | 4 ++--
 tools/verification/dot2/dot2k_templates/main_per_cpu.c  | 4 ++--
 tools/verification/dot2/dot2k_templates/main_per_task.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/verification/dot2/dot2k_templates/main_global.c b/tools/verification/dot2/dot2k_templates/main_global.c
index f4b712dbc92e..dcd1162dced8 100644
--- a/tools/verification/dot2/dot2k_templates/main_global.c
+++ b/tools/verification/dot2/dot2k_templates/main_global.c
@@ -27,7 +27,7 @@
  *
  * The rv monitor reference is needed for the monitor declaration.
  */
-struct rv_monitor rv_MODEL_NAME;
+static struct rv_monitor rv_MODEL_NAME;
 DECLARE_DA_MON_GLOBAL(MODEL_NAME, MIN_TYPE);
 
 /*
@@ -63,7 +63,7 @@ TRACEPOINT_DETACH
 /*
  * This is the monitor register section.
  */
-struct rv_monitor rv_MODEL_NAME = {
+static struct rv_monitor rv_MODEL_NAME = {
 	.name = "MODEL_NAME",
 	.description = "auto-generated MODEL_NAME",
 	.enable = enable_MODEL_NAME,
diff --git a/tools/verification/dot2/dot2k_templates/main_per_cpu.c b/tools/verification/dot2/dot2k_templates/main_per_cpu.c
index 4080d1ca3354..8f877e86a22f 100644
--- a/tools/verification/dot2/dot2k_templates/main_per_cpu.c
+++ b/tools/verification/dot2/dot2k_templates/main_per_cpu.c
@@ -27,7 +27,7 @@
  *
  * The rv monitor reference is needed for the monitor declaration.
  */
-struct rv_monitor rv_MODEL_NAME;
+static struct rv_monitor rv_MODEL_NAME;
 DECLARE_DA_MON_PER_CPU(MODEL_NAME, MIN_TYPE);
 
 /*
@@ -63,7 +63,7 @@ TRACEPOINT_DETACH
 /*
  * This is the monitor register section.
  */
-struct rv_monitor rv_MODEL_NAME = {
+static struct rv_monitor rv_MODEL_NAME = {
 	.name = "MODEL_NAME",
 	.description = "auto-generated MODEL_NAME",
 	.enable = enable_MODEL_NAME,
diff --git a/tools/verification/dot2/dot2k_templates/main_per_task.c b/tools/verification/dot2/dot2k_templates/main_per_task.c
index 89197175384f..8c2fdb824634 100644
--- a/tools/verification/dot2/dot2k_templates/main_per_task.c
+++ b/tools/verification/dot2/dot2k_templates/main_per_task.c
@@ -27,7 +27,7 @@
  *
  * The rv monitor reference is needed for the monitor declaration.
  */
-struct rv_monitor rv_MODEL_NAME;
+static struct rv_monitor rv_MODEL_NAME;
 DECLARE_DA_MON_PER_TASK(MODEL_NAME, MIN_TYPE);
 
 /*
@@ -63,7 +63,7 @@ TRACEPOINT_DETACH
 /*
  * This is the monitor register section.
  */
-struct rv_monitor rv_MODEL_NAME = {
+static struct rv_monitor rv_MODEL_NAME = {
 	.name = "MODEL_NAME",
 	.description = "auto-generated MODEL_NAME",
 	.enable = enable_MODEL_NAME,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next 1/2] rv/monitors: add 'static' qualifier for local symbols
  2022-08-24  3:43 ` [PATCH -next 1/2] rv/monitors: add 'static' qualifier for local symbols Zeng Heng
@ 2022-08-24  6:33   ` Daniel Bristot de Oliveira
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Bristot de Oliveira @ 2022-08-24  6:33 UTC (permalink / raw)
  To: Zeng Heng, mingo, rostedt; +Cc: linux-kernel

On 8/24/22 05:43, Zeng Heng wrote:
> The sparse tool complains as follows:
> 
> kernel/trace/rv/monitors/wwnr/wwnr.c:18:19:
> warning: symbol 'rv_wwnr' was not declared. Should it be static?
> 
> The `rv_wwnr` symbol is not dereferenced by other extern files,
> so add static qualifier for it.
> 
> So does wip module.
> 
> Fixes:	ccc319dcb450 ("rv/monitor: Add the wwnr monitor")
> Fixes:	8812d21219b9 ("rv/monitor: Add the wip monitor skeleton created by dot2k")
> Signed-off-by: Zeng Heng <zengheng4@huawei.com>

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

Thanks!
-- Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next 2/2] rv/dot2K: add 'static' qualifier for local variable
  2022-08-24  3:43 ` [PATCH -next 2/2] rv/dot2K: add 'static' qualifier for local variable Zeng Heng
@ 2022-08-24  6:33   ` Daniel Bristot de Oliveira
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Bristot de Oliveira @ 2022-08-24  6:33 UTC (permalink / raw)
  To: Zeng Heng, mingo, rostedt; +Cc: linux-kernel

On 8/24/22 05:43, Zeng Heng wrote:
> Following Daniel's suggestion, fix similar warning
> in template files, which would prevent new monitors
> from such warning.
> 
> Fixes:	24bce201d798 ("tools/rv: Add dot2k")
> Suggested-by: Daniel Bristot de Oliveira <bristot@kernel.org>
> Signed-off-by: Zeng Heng <zengheng4@huawei.com>

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

Thanks!
-- Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-24  6:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-24  3:43 [PATCH 0/2] rv/monitors: fix sparse warning about lack of static qualifier Zeng Heng
2022-08-24  3:43 ` [PATCH -next 1/2] rv/monitors: add 'static' qualifier for local symbols Zeng Heng
2022-08-24  6:33   ` Daniel Bristot de Oliveira
2022-08-24  3:43 ` [PATCH -next 2/2] rv/dot2K: add 'static' qualifier for local variable Zeng Heng
2022-08-24  6:33   ` Daniel Bristot de Oliveira

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®