Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing: Convert function graph set_flags() to use a switch() statement

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.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: https://patch.msgid.link/20251114192319.117123664@kernel.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

+7 -5
+7 -5
kernel/trace/trace_functions_graph.c
··· 1664 1664 if (!!set == !!(tr->current_trace_flags->val & bit)) 1665 1665 return 0; 1666 1666 1667 - if (bit == TRACE_GRAPH_SLEEP_TIME) { 1667 + switch (bit) { 1668 + case TRACE_GRAPH_SLEEP_TIME: 1668 1669 if (set) { 1669 1670 fgraph_no_sleep_time--; 1670 1671 if (WARN_ON_ONCE(fgraph_no_sleep_time < 0)) ··· 1673 1672 } else { 1674 1673 fgraph_no_sleep_time++; 1675 1674 } 1676 - } 1675 + break; 1677 1676 1678 - if (bit == TRACE_GRAPH_PRINT_IRQS) { 1677 + case TRACE_GRAPH_PRINT_IRQS: 1679 1678 if (set) 1680 1679 ftrace_graph_skip_irqs--; 1681 1680 else 1682 1681 ftrace_graph_skip_irqs++; 1683 1682 if (WARN_ON_ONCE(ftrace_graph_skip_irqs < 0)) 1684 1683 ftrace_graph_skip_irqs = 0; 1685 - } 1684 + break; 1686 1685 1687 - if (bit == TRACE_GRAPH_ARGS) 1686 + case TRACE_GRAPH_ARGS: 1688 1687 return ftrace_graph_trace_args(tr, set); 1688 + } 1689 1689 1690 1690 return 0; 1691 1691 }