* [PATCH] tracing/osnoise: Fix sparse warning in function start_kthread
@ 2022-01-04 9:48 Wang ShaoBo
2022-01-04 10:12 ` Daniel Bristot de Oliveira
0 siblings, 1 reply; 2+ messages in thread
From: Wang ShaoBo @ 2022-01-04 9:48 UTC (permalink / raw)
To: rostedt; +Cc: xiexiuqi, cj.chengjian, liwei391, bristot, linux-kernel
Change main to main_func to fix following sparse warning:
kernel/trace/trace_osnoise.c: In function ‘start_kthread’:
kernel/trace/trace_osnoise.c:1674:8: warning: ‘main’ is usually a function [-Wmain]
void *main = osnoise_main;
^~~~
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
---
kernel/trace/trace_osnoise.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 7520d43aed55..2bebf31d4baf 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -1691,17 +1691,17 @@ static void stop_per_cpu_kthreads(void)
static int start_kthread(unsigned int cpu)
{
struct task_struct *kthread;
- void *main = osnoise_main;
+ void *main_func = osnoise_main;
char comm[24];
if (timerlat_enabled()) {
snprintf(comm, 24, "timerlat/%d", cpu);
- main = timerlat_main;
+ main_func = timerlat_main;
} else {
snprintf(comm, 24, "osnoise/%d", cpu);
}
- kthread = kthread_create_on_cpu(main, NULL, cpu, comm);
+ kthread = kthread_create_on_cpu(main_func, NULL, cpu, comm);
if (IS_ERR(kthread)) {
pr_err(BANNER "could not start sampling thread\n");
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tracing/osnoise: Fix sparse warning in function start_kthread
2022-01-04 9:48 [PATCH] tracing/osnoise: Fix sparse warning in function start_kthread Wang ShaoBo
@ 2022-01-04 10:12 ` Daniel Bristot de Oliveira
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Bristot de Oliveira @ 2022-01-04 10:12 UTC (permalink / raw)
To: Wang ShaoBo, rostedt; +Cc: xiexiuqi, cj.chengjian, liwei391, linux-kernel
On 1/4/22 10:48, Wang ShaoBo wrote:
> Change main to main_func to fix following sparse warning:
>
> kernel/trace/trace_osnoise.c: In function ‘start_kthread’:
> kernel/trace/trace_osnoise.c:1674:8: warning: ‘main’ is usually a function [-Wmain]
> void *main = osnoise_main;
> ^~~~
NAK!
This was already discussed... many times. The problem is not in the usage of
main as a variable name but in the tool that you are using. Try to fix your tool.
E.g., https://lore.kernel.org/lkml/20210813224131.25803-1-rdunlap@infradead.org/
-- Daniel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-04 10:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 9:48 [PATCH] tracing/osnoise: Fix sparse warning in function start_kthread Wang ShaoBo
2022-01-04 10:12 ` 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;
as well as URLs for NNTP newsgroup(s).