From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 4/4] tracing: Convert function graph set_flags() to use a switch() statement
Date: Fri, 14 Nov 2025 14:22:33 -0500 [thread overview]
Message-ID: <20251114192319.117123664@kernel.org> (raw)
In-Reply-To: 20251114192229.829042264@kernel.org
From: Steven Rostedt <rostedt@goodmis.org>
Currently the set_flags() of the function graph tracer has a bunch of:
if (bit == FLAG1) {
[..]
}
if (bit == FLAG2) {
[..]
}
To clean it up a bit, convert it over to a switch statement.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_functions_graph.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 12315eb65925..44d5dc5031e2 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -1664,7 +1664,8 @@ func_graph_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
if (!!set == !!(tr->current_trace_flags->val & bit))
return 0;
- if (bit == TRACE_GRAPH_SLEEP_TIME) {
+ switch (bit) {
+ case TRACE_GRAPH_SLEEP_TIME:
if (set) {
fgraph_no_sleep_time--;
if (WARN_ON_ONCE(fgraph_no_sleep_time < 0))
@@ -1672,19 +1673,20 @@ func_graph_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
} else {
fgraph_no_sleep_time++;
}
- }
+ break;
- if (bit == TRACE_GRAPH_PRINT_IRQS) {
+ case TRACE_GRAPH_PRINT_IRQS:
if (set)
ftrace_graph_skip_irqs--;
else
ftrace_graph_skip_irqs++;
if (WARN_ON_ONCE(ftrace_graph_skip_irqs < 0))
ftrace_graph_skip_irqs = 0;
- }
+ break;
- if (bit == TRACE_GRAPH_ARGS)
+ case TRACE_GRAPH_ARGS:
return ftrace_graph_trace_args(tr, set);
+ }
return 0;
}
--
2.51.0
prev parent reply other threads:[~2025-11-14 19:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 19:22 [PATCH 0/4] tracing: Make more function graph tracer options per-instance Steven Rostedt
2025-11-14 19:22 ` [PATCH 1/4] tracing: Have function graph tracer option funcgraph-irqs be per instance Steven Rostedt
2025-11-14 19:22 ` [PATCH 2/4] tracing: Move graph-time out of function graph options Steven Rostedt
2025-11-14 19:22 ` [PATCH 3/4] tracing: Have function graph tracer option sleep-time be per instance Steven Rostedt
2025-11-14 19:22 ` Steven Rostedt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251114192319.117123664@kernel.org \
--to=rostedt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).