Skip to content

Commit

Permalink
tracing: Remove ops param from event_command reg()/unreg() callbacks
Browse files Browse the repository at this point in the history
The event_trigger_ops for an event_command are already accessible via
event_trigger_data.ops so remove the redundant ops from the callback.

Link: https://lkml.kernel.org/r/4c6f2a41820452f9cacddc7634ad442928aa2aa6.1641823001.git.zanussi@kernel.org

Signed-off-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Tom Zanussi authored and Steven Rostedt committed Jan 10, 2022
1 parent fb339e5 commit 2378a2d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 28 deletions.
4 changes: 0 additions & 4 deletions kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -1582,11 +1582,9 @@ extern int event_enable_trigger_parse(struct event_command *cmd_ops,
struct trace_event_file *file,
char *glob, char *cmd, char *param);
extern int event_enable_register_trigger(char *glob,
struct event_trigger_ops *ops,
struct event_trigger_data *data,
struct trace_event_file *file);
extern void event_enable_unregister_trigger(char *glob,
struct event_trigger_ops *ops,
struct event_trigger_data *test,
struct trace_event_file *file);
extern void trigger_data_free(struct event_trigger_data *data);
Expand Down Expand Up @@ -1763,11 +1761,9 @@ struct event_command {
char *glob, char *cmd,
char *param_and_filter);
int (*reg)(char *glob,
struct event_trigger_ops *ops,
struct event_trigger_data *data,
struct trace_event_file *file);
void (*unreg)(char *glob,
struct event_trigger_ops *ops,
struct event_trigger_data *data,
struct trace_event_file *file);
void (*unreg_all)(struct trace_event_file *file);
Expand Down
12 changes: 6 additions & 6 deletions kernel/trace/trace_eprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,16 +556,16 @@ static int eprobe_trigger_cmd_parse(struct event_command *cmd_ops,
return -1;
}

static int eprobe_trigger_reg_func(char *glob, struct event_trigger_ops *ops,
struct event_trigger_data *data,
struct trace_event_file *file)
static int eprobe_trigger_reg_func(char *glob,
struct event_trigger_data *data,
struct trace_event_file *file)
{
return -1;
}

static void eprobe_trigger_unreg_func(char *glob, struct event_trigger_ops *ops,
struct event_trigger_data *data,
struct trace_event_file *file)
static void eprobe_trigger_unreg_func(char *glob,
struct event_trigger_data *data,
struct trace_event_file *file)
{

}
Expand Down
10 changes: 5 additions & 5 deletions kernel/trace/trace_events_hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -5910,7 +5910,7 @@ static bool hist_trigger_match(struct event_trigger_data *data,
return true;
}

static int hist_register_trigger(char *glob, struct event_trigger_ops *ops,
static int hist_register_trigger(char *glob,
struct event_trigger_data *data,
struct trace_event_file *file)
{
Expand Down Expand Up @@ -6062,7 +6062,7 @@ static bool hist_trigger_check_refs(struct event_trigger_data *data,
return false;
}

static void hist_unregister_trigger(char *glob, struct event_trigger_ops *ops,
static void hist_unregister_trigger(char *glob,
struct event_trigger_data *data,
struct trace_event_file *file)
{
Expand Down Expand Up @@ -6262,7 +6262,7 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops,
goto out_free;
}

cmd_ops->unreg(glob+1, trigger_ops, trigger_data, file);
cmd_ops->unreg(glob+1, trigger_data, file);
se_name = trace_event_name(file->event_call);
se = find_synth_event(se_name);
if (se)
Expand All @@ -6271,7 +6271,7 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops,
goto out_free;
}

ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
ret = cmd_ops->reg(glob, trigger_data, file);
/*
* The above returns on success the # of triggers registered,
* but if it didn't register any it returns zero. Consider no
Expand Down Expand Up @@ -6314,7 +6314,7 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops,

return ret;
out_unreg:
cmd_ops->unreg(glob+1, trigger_ops, trigger_data, file);
cmd_ops->unreg(glob+1, trigger_data, file);
out_free:
if (cmd_ops->set_filter)
cmd_ops->set_filter(NULL, trigger_data, NULL);
Expand Down
22 changes: 9 additions & 13 deletions kernel/trace/trace_events_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,6 @@ void update_cond_flag(struct trace_event_file *file)
/**
* register_trigger - Generic event_command @reg implementation
* @glob: The raw string used to register the trigger
* @ops: The trigger ops associated with the trigger
* @data: Trigger-specific data to associate with the trigger
* @file: The trace_event_file associated with the event
*
Expand All @@ -551,7 +550,7 @@ void update_cond_flag(struct trace_event_file *file)
*
* Return: 0 on success, errno otherwise
*/
static int register_trigger(char *glob, struct event_trigger_ops *ops,
static int register_trigger(char *glob,
struct event_trigger_data *data,
struct trace_event_file *file)
{
Expand Down Expand Up @@ -589,7 +588,6 @@ static int register_trigger(char *glob, struct event_trigger_ops *ops,
/**
* unregister_trigger - Generic event_command @unreg implementation
* @glob: The raw string used to register the trigger
* @ops: The trigger ops associated with the trigger
* @test: Trigger-specific data used to find the trigger to remove
* @file: The trace_event_file associated with the event
*
Expand All @@ -598,7 +596,7 @@ static int register_trigger(char *glob, struct event_trigger_ops *ops,
* Usually used directly as the @unreg method in event command
* implementations.
*/
static void unregister_trigger(char *glob, struct event_trigger_ops *ops,
static void unregister_trigger(char *glob,
struct event_trigger_data *test,
struct trace_event_file *file)
{
Expand Down Expand Up @@ -673,7 +671,7 @@ event_trigger_parse(struct event_command *cmd_ops,
INIT_LIST_HEAD(&trigger_data->named_list);

if (glob[0] == '!') {
cmd_ops->unreg(glob+1, trigger_ops, trigger_data, file);
cmd_ops->unreg(glob+1, trigger_data, file);
kfree(trigger_data);
ret = 0;
goto out;
Expand Down Expand Up @@ -708,14 +706,14 @@ event_trigger_parse(struct event_command *cmd_ops,
out_reg:
/* Up the trigger_data count to make sure reg doesn't free it on failure */
event_trigger_init(trigger_ops, trigger_data);
ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
ret = cmd_ops->reg(glob, trigger_data, file);
/*
* The above returns on success the # of functions enabled,
* but if it didn't find any functions it returns zero.
* Consider no functions a failure too.
*/
if (!ret) {
cmd_ops->unreg(glob, trigger_ops, trigger_data, file);
cmd_ops->unreg(glob, trigger_data, file);
ret = -ENOENT;
} else if (ret > 0)
ret = 0;
Expand Down Expand Up @@ -1116,14 +1114,14 @@ snapshot_count_trigger(struct event_trigger_data *data,
}

static int
register_snapshot_trigger(char *glob, struct event_trigger_ops *ops,
register_snapshot_trigger(char *glob,
struct event_trigger_data *data,
struct trace_event_file *file)
{
if (tracing_alloc_snapshot_instance(file->tr) != 0)
return 0;

return register_trigger(glob, ops, data, file);
return register_trigger(glob, data, file);
}

static int
Expand Down Expand Up @@ -1455,7 +1453,7 @@ int event_enable_trigger_parse(struct event_command *cmd_ops,
trigger_data->private_data = enable_data;

if (glob[0] == '!') {
cmd_ops->unreg(glob+1, trigger_ops, trigger_data, file);
cmd_ops->unreg(glob+1, trigger_data, file);
kfree(trigger_data);
kfree(enable_data);
ret = 0;
Expand Down Expand Up @@ -1502,7 +1500,7 @@ int event_enable_trigger_parse(struct event_command *cmd_ops,
ret = trace_event_enable_disable(event_enable_file, 1, 1);
if (ret < 0)
goto out_put;
ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
ret = cmd_ops->reg(glob, trigger_data, file);
/*
* The above returns on success the # of functions enabled,
* but if it didn't find any functions it returns zero.
Expand Down Expand Up @@ -1532,7 +1530,6 @@ int event_enable_trigger_parse(struct event_command *cmd_ops,
}

int event_enable_register_trigger(char *glob,
struct event_trigger_ops *ops,
struct event_trigger_data *data,
struct trace_event_file *file)
{
Expand Down Expand Up @@ -1574,7 +1571,6 @@ int event_enable_register_trigger(char *glob,
}

void event_enable_unregister_trigger(char *glob,
struct event_trigger_ops *ops,
struct event_trigger_data *test,
struct trace_event_file *file)
{
Expand Down

0 comments on commit 2378a2d

Please sign in to comment.