Skip to content

Commit c8b039c

Browse files
committed
tracing: Have all triggers expect a file parameter
When the triggers were first created, they may not have had a file parameter passed to them and things needed to be done generically. But today, all triggers have a file parameter passed to them. Remove the generic code and add a "if (WARN_ON_ONCE(!file))" to each trigger. Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Reviewed-by: Tom Zanussi <zanussi@kernel.org> Link: https://patch.msgid.link/20260206101351.609d8906@gandalf.local.home Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 2cdfe39 commit c8b039c

1 file changed

Lines changed: 24 additions & 38 deletions

File tree

kernel/trace/trace_events_trigger.c

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,18 +1347,13 @@ traceon_trigger(struct event_trigger_data *data,
13471347
{
13481348
struct trace_event_file *file = data->private_data;
13491349

1350-
if (file) {
1351-
if (tracer_tracing_is_on(file->tr))
1352-
return;
1353-
1354-
tracer_tracing_on(file->tr);
1350+
if (WARN_ON_ONCE(!file))
13551351
return;
1356-
}
13571352

1358-
if (tracing_is_on())
1353+
if (tracer_tracing_is_on(file->tr))
13591354
return;
13601355

1361-
tracing_on();
1356+
tracer_tracing_on(file->tr);
13621357
}
13631358

13641359
static bool
@@ -1368,13 +1363,11 @@ traceon_count_func(struct event_trigger_data *data,
13681363
{
13691364
struct trace_event_file *file = data->private_data;
13701365

1371-
if (file) {
1372-
if (tracer_tracing_is_on(file->tr))
1373-
return false;
1374-
} else {
1375-
if (tracing_is_on())
1376-
return false;
1377-
}
1366+
if (WARN_ON_ONCE(!file))
1367+
return false;
1368+
1369+
if (tracer_tracing_is_on(file->tr))
1370+
return false;
13781371

13791372
if (!data->count)
13801373
return false;
@@ -1392,18 +1385,13 @@ traceoff_trigger(struct event_trigger_data *data,
13921385
{
13931386
struct trace_event_file *file = data->private_data;
13941387

1395-
if (file) {
1396-
if (!tracer_tracing_is_on(file->tr))
1397-
return;
1398-
1399-
tracer_tracing_off(file->tr);
1388+
if (WARN_ON_ONCE(!file))
14001389
return;
1401-
}
14021390

1403-
if (!tracing_is_on())
1391+
if (!tracer_tracing_is_on(file->tr))
14041392
return;
14051393

1406-
tracing_off();
1394+
tracer_tracing_off(file->tr);
14071395
}
14081396

14091397
static bool
@@ -1413,13 +1401,11 @@ traceoff_count_func(struct event_trigger_data *data,
14131401
{
14141402
struct trace_event_file *file = data->private_data;
14151403

1416-
if (file) {
1417-
if (!tracer_tracing_is_on(file->tr))
1418-
return false;
1419-
} else {
1420-
if (!tracing_is_on())
1421-
return false;
1422-
}
1404+
if (WARN_ON_ONCE(!file))
1405+
return false;
1406+
1407+
if (!tracer_tracing_is_on(file->tr))
1408+
return false;
14231409

14241410
if (!data->count)
14251411
return false;
@@ -1481,10 +1467,10 @@ snapshot_trigger(struct event_trigger_data *data,
14811467
{
14821468
struct trace_event_file *file = data->private_data;
14831469

1484-
if (file)
1485-
tracing_snapshot_instance(file->tr);
1486-
else
1487-
tracing_snapshot();
1470+
if (WARN_ON_ONCE(!file))
1471+
return;
1472+
1473+
tracing_snapshot_instance(file->tr);
14881474
}
14891475

14901476
static int
@@ -1570,10 +1556,10 @@ stacktrace_trigger(struct event_trigger_data *data,
15701556
{
15711557
struct trace_event_file *file = data->private_data;
15721558

1573-
if (file)
1574-
__trace_stack(file->tr, tracing_gen_ctx_dec(), STACK_SKIP);
1575-
else
1576-
trace_dump_stack(STACK_SKIP);
1559+
if (WARN_ON_ONCE(!file))
1560+
return;
1561+
1562+
__trace_stack(file->tr, tracing_gen_ctx_dec(), STACK_SKIP);
15771563
}
15781564

15791565
static int

0 commit comments

Comments
 (0)