tracing: Use generic type for comparator function
Comparator function type, cmp_func_t, is defined in the types.h, use it in the code. Link: http://lkml.kernel.org/r/20191007135656.37734-3-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
e8877ec5db
commit
80042c8f06
@ -465,10 +465,10 @@ static void *function_stat_start(struct tracer_stat *trace)
|
|||||||
|
|
||||||
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
||||||
/* function graph compares on total time */
|
/* function graph compares on total time */
|
||||||
static int function_stat_cmp(void *p1, void *p2)
|
static int function_stat_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
struct ftrace_profile *a = p1;
|
const struct ftrace_profile *a = p1;
|
||||||
struct ftrace_profile *b = p2;
|
const struct ftrace_profile *b = p2;
|
||||||
|
|
||||||
if (a->time < b->time)
|
if (a->time < b->time)
|
||||||
return -1;
|
return -1;
|
||||||
@ -479,10 +479,10 @@ static int function_stat_cmp(void *p1, void *p2)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* not function graph compares against hits */
|
/* not function graph compares against hits */
|
||||||
static int function_stat_cmp(void *p1, void *p2)
|
static int function_stat_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
struct ftrace_profile *a = p1;
|
const struct ftrace_profile *a = p1;
|
||||||
struct ftrace_profile *b = p2;
|
const struct ftrace_profile *b = p2;
|
||||||
|
|
||||||
if (a->counter < b->counter)
|
if (a->counter < b->counter)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -244,7 +244,7 @@ static int annotated_branch_stat_headers(struct seq_file *m)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline long get_incorrect_percent(struct ftrace_branch_data *p)
|
static inline long get_incorrect_percent(const struct ftrace_branch_data *p)
|
||||||
{
|
{
|
||||||
long percent;
|
long percent;
|
||||||
|
|
||||||
@ -332,10 +332,10 @@ annotated_branch_stat_next(void *v, int idx)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int annotated_branch_stat_cmp(void *p1, void *p2)
|
static int annotated_branch_stat_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
struct ftrace_branch_data *a = p1;
|
const struct ftrace_branch_data *a = p1;
|
||||||
struct ftrace_branch_data *b = p2;
|
const struct ftrace_branch_data *b = p2;
|
||||||
|
|
||||||
long percent_a, percent_b;
|
long percent_a, percent_b;
|
||||||
|
|
||||||
|
@ -72,9 +72,7 @@ static void destroy_session(struct stat_session *session)
|
|||||||
kfree(session);
|
kfree(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef int (*cmp_stat_t)(void *, void *);
|
static int insert_stat(struct rb_root *root, void *stat, cmp_func_t cmp)
|
||||||
|
|
||||||
static int insert_stat(struct rb_root *root, void *stat, cmp_stat_t cmp)
|
|
||||||
{
|
{
|
||||||
struct rb_node **new = &(root->rb_node), *parent = NULL;
|
struct rb_node **new = &(root->rb_node), *parent = NULL;
|
||||||
struct stat_node *data;
|
struct stat_node *data;
|
||||||
@ -112,7 +110,7 @@ static int insert_stat(struct rb_root *root, void *stat, cmp_stat_t cmp)
|
|||||||
* This one will force an insertion as right-most node
|
* This one will force an insertion as right-most node
|
||||||
* in the rbtree.
|
* in the rbtree.
|
||||||
*/
|
*/
|
||||||
static int dummy_cmp(void *p1, void *p2)
|
static int dummy_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ struct tracer_stat {
|
|||||||
void *(*stat_start)(struct tracer_stat *trace);
|
void *(*stat_start)(struct tracer_stat *trace);
|
||||||
void *(*stat_next)(void *prev, int idx);
|
void *(*stat_next)(void *prev, int idx);
|
||||||
/* Compare two entries for stats sorting */
|
/* Compare two entries for stats sorting */
|
||||||
int (*stat_cmp)(void *p1, void *p2);
|
cmp_func_t stat_cmp;
|
||||||
/* Print a stat entry */
|
/* Print a stat entry */
|
||||||
int (*stat_show)(struct seq_file *s, void *p);
|
int (*stat_show)(struct seq_file *s, void *p);
|
||||||
/* Release an entry */
|
/* Release an entry */
|
||||||
|
Loading…
Reference in New Issue
Block a user