trace: fix compiler warning in branch profiler

Impact: fix compiler warning

The ftrace_pointers used in the branch profiler are constant values.
They should never change. But the compiler complains when they are
passed into the debugfs_create_file as a data pointer, because the
function discards the qualifier.

This patch typecasts the parameter to debugfs_create_file back to
a void pointer. To remind the callbacks that they are pointing to
a constant value, I also modified the callback local pointers to
be const struct ftrace_pointer * as well.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Steven Rostedt 2008-11-21 14:44:57 -05:00 committed by Ingo Molnar
parent 2bcd521a68
commit 0429149fb5

View File

@ -191,7 +191,7 @@ struct ftrace_pointer {
static void * static void *
t_next(struct seq_file *m, void *v, loff_t *pos) t_next(struct seq_file *m, void *v, loff_t *pos)
{ {
struct ftrace_pointer *f = m->private; const struct ftrace_pointer *f = m->private;
struct ftrace_branch_data *p = v; struct ftrace_branch_data *p = v;
(*pos)++; (*pos)++;
@ -224,7 +224,7 @@ static void t_stop(struct seq_file *m, void *p)
static int t_show(struct seq_file *m, void *v) static int t_show(struct seq_file *m, void *v)
{ {
struct ftrace_pointer *fp = m->private; const struct ftrace_pointer *fp = m->private;
struct ftrace_branch_data *p = v; struct ftrace_branch_data *p = v;
const char *f; const char *f;
long percent; long percent;
@ -296,7 +296,7 @@ static const struct file_operations tracing_branch_fops = {
extern unsigned long __start_branch_profile[]; extern unsigned long __start_branch_profile[];
extern unsigned long __stop_branch_profile[]; extern unsigned long __stop_branch_profile[];
static struct ftrace_pointer ftrace_branch_pos = { static const struct ftrace_pointer ftrace_branch_pos = {
.start = __start_branch_profile, .start = __start_branch_profile,
.stop = __stop_branch_profile, .stop = __stop_branch_profile,
.hit = 1, .hit = 1,
@ -320,7 +320,7 @@ static __init int ftrace_branch_init(void)
d_tracer = tracing_init_dentry(); d_tracer = tracing_init_dentry();
entry = debugfs_create_file("profile_annotated_branch", 0444, d_tracer, entry = debugfs_create_file("profile_annotated_branch", 0444, d_tracer,
&ftrace_annotated_branch_pos, (void *)&ftrace_annotated_branch_pos,
&tracing_branch_fops); &tracing_branch_fops);
if (!entry) if (!entry)
pr_warning("Could not create debugfs " pr_warning("Could not create debugfs "
@ -328,7 +328,7 @@ static __init int ftrace_branch_init(void)
#ifdef CONFIG_PROFILE_ALL_BRANCHES #ifdef CONFIG_PROFILE_ALL_BRANCHES
entry = debugfs_create_file("profile_branch", 0444, d_tracer, entry = debugfs_create_file("profile_branch", 0444, d_tracer,
&ftrace_branch_pos, (void *)&ftrace_branch_pos,
&tracing_branch_fops); &tracing_branch_fops);
if (!entry) if (!entry)
pr_warning("Could not create debugfs" pr_warning("Could not create debugfs"