Re: [PATCH v2] Fix bug and add osnoise_trace_is_off()

From: Dan Carpenter
Date: Wed Jan 15 2025 - 06:12:33 EST


On Wed, Jan 15, 2025 at 10:09:56AM +0200, Costa Shulyupin wrote:
> diff --git a/tools/tracing/rtla/src/osnoise.c b/tools/tracing/rtla/src/osnoise.c
> index 245e9344932bc..20275642a74cd 100644
> --- a/tools/tracing/rtla/src/osnoise.c
> +++ b/tools/tracing/rtla/src/osnoise.c
> @@ -1079,6 +1079,25 @@ struct osnoise_tool *osnoise_init_trace_tool(char *tracer)
> return NULL;
> }
>
> +int osnoise_trace_is_off(struct osnoise_tool *tool, struct osnoise_tool *record)
> +{
> + /*
> + * The tool instance is always present, it is the one used to collect
> + * data.
> + */
> + if (!tracefs_trace_is_on(tool->trace.inst))
> + return 1;
> +
> + /*
> + * The trace record instance is only enabled when -t is set. IOW, when the system
> + * is tracing.
> + */
> + if (record && !tracefs_trace_is_on(record->trace.inst))
> + return 1;
> +
> + return 0;
> +}

Also this function should be declared as type bool and return true/false
instead of 1/0.

regards,
dan carpenter