Skip to content

Commit 1a48df0

Browse files
committed
ftrace: Remove data field from ftrace_func_probe structure
No users of the function probes uses the data field anymore. Remove it, and change the init function to take a void *data parameter instead of a void **data, because the init will just get the data that the registering function was received, and there's no state after it is called. The other functions for ftrace_probe_ops still take the data parameter, but it will currently only be passed NULL. It will stay as a parameter for future data to be passed to these functions. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 02b77e2 commit 1a48df0

5 files changed

Lines changed: 11 additions & 15 deletions

File tree

‎kernel/trace/ftrace.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,6 @@ struct ftrace_func_probe {
11021102
struct hlist_node node;
11031103
struct ftrace_probe_ops *ops;
11041104
unsigned long ip;
1105-
void *data;
11061105
struct list_head free_list;
11071106
};
11081107

@@ -3152,7 +3151,7 @@ t_hash_show(struct seq_file *m, struct ftrace_iterator *iter)
31523151
return -EIO;
31533152

31543153
if (rec->ops->print)
3155-
return rec->ops->print(m, rec->ip, rec->ops, rec->data);
3154+
return rec->ops->print(m, rec->ip, rec->ops, NULL);
31563155

31573156
seq_printf(m, "%ps:%ps\n", (void *)rec->ip, (void *)rec->ops->func);
31583157

@@ -3735,7 +3734,7 @@ static void function_trace_probe_call(unsigned long ip, unsigned long parent_ip,
37353734
preempt_disable_notrace();
37363735
hlist_for_each_entry_rcu_notrace(entry, hhd, node) {
37373736
if (entry->ip == ip)
3738-
entry->ops->func(ip, parent_ip, entry->ops, &entry->data);
3737+
entry->ops->func(ip, parent_ip, entry->ops, NULL);
37393738
}
37403739
preempt_enable_notrace();
37413740
}
@@ -3800,7 +3799,7 @@ static bool __disable_ftrace_function_probe(void)
38003799
static void ftrace_free_entry(struct ftrace_func_probe *entry)
38013800
{
38023801
if (entry->ops->free)
3803-
entry->ops->free(entry->ops, entry->ip, &entry->data);
3802+
entry->ops->free(entry->ops, entry->ip, NULL);
38043803
kfree(entry);
38053804
}
38063805

@@ -4007,15 +4006,13 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
40074006

40084007
count++;
40094008

4010-
entry->data = data;
4011-
40124009
/*
40134010
* The caller might want to do something special
40144011
* for each function we find. We call the callback
40154012
* to give the caller an opportunity to do so.
40164013
*/
40174014
if (ops->init) {
4018-
if (ops->init(ops, rec->ip, &entry->data) < 0) {
4015+
if (ops->init(ops, rec->ip, data) < 0) {
40194016
/* caller does not like this func */
40204017
kfree(entry);
40214018
continue;

‎kernel/trace/trace.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6786,11 +6786,11 @@ ftrace_snapshot_print(struct seq_file *m, unsigned long ip,
67866786

67876787
static int
67886788
ftrace_snapshot_init(struct ftrace_probe_ops *ops, unsigned long ip,
6789-
void **data)
6789+
void *data)
67906790
{
67916791
struct ftrace_func_mapper *mapper = ops->private_data;
67926792

6793-
return ftrace_func_mapper_add_ip(mapper, ip, *data);
6793+
return ftrace_func_mapper_add_ip(mapper, ip, data);
67946794
}
67956795

67966796
static void

‎kernel/trace/trace.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ struct ftrace_probe_ops {
937937
struct ftrace_probe_ops *ops,
938938
void **data);
939939
int (*init)(struct ftrace_probe_ops *ops,
940-
unsigned long ip, void **data);
940+
unsigned long ip, void *data);
941941
void (*free)(struct ftrace_probe_ops *ops,
942942
unsigned long ip, void **data);
943943
int (*print)(struct seq_file *m,

‎kernel/trace/trace_events.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,11 +2543,10 @@ event_enable_print(struct seq_file *m, unsigned long ip,
25432543

25442544
static int
25452545
event_enable_init(struct ftrace_probe_ops *ops, unsigned long ip,
2546-
void **_data)
2546+
void *_data)
25472547
{
25482548
struct ftrace_func_mapper *mapper = ops->private_data;
2549-
struct event_probe_data **pdata = (struct event_probe_data **)_data;
2550-
struct event_probe_data *data = *pdata;
2549+
struct event_probe_data *data = _data;
25512550
int ret;
25522551

25532552
ret = ftrace_func_mapper_add_ip(mapper, ip, data);

‎kernel/trace/trace_functions.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,11 @@ ftrace_cpudump_print(struct seq_file *m, unsigned long ip,
509509

510510
static int
511511
ftrace_count_init(struct ftrace_probe_ops *ops, unsigned long ip,
512-
void **data)
512+
void *data)
513513
{
514514
struct ftrace_func_mapper *mapper = ops->private_data;
515515

516-
return ftrace_func_mapper_add_ip(mapper, ip, *data);
516+
return ftrace_func_mapper_add_ip(mapper, ip, data);
517517
}
518518

519519
static void

0 commit comments

Comments
 (0)