[PATCH] trace/trace_stat: use rb_entry()

From: Geliang Tang
Date: Mon Dec 19 2016 - 10:05:50 EST


To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@xxxxxxxxx>
---
kernel/trace/trace_stat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c
index 413ff10..0765150 100644
--- a/kernel/trace/trace_stat.c
+++ b/kernel/trace/trace_stat.c
@@ -91,7 +91,7 @@ static int insert_stat(struct rb_root *root, void *stat, cmp_stat_t cmp)
struct stat_node *this;
int result;

- this = container_of(*new, struct stat_node, node);
+ this = rb_entry(*new, struct stat_node, node);
result = cmp(data->stat, this->stat);

parent = *new;
@@ -215,7 +215,7 @@ static void stat_seq_stop(struct seq_file *s, void *p)
static int stat_seq_show(struct seq_file *s, void *v)
{
struct stat_session *session = s->private;
- struct stat_node *l = container_of(v, struct stat_node, node);
+ struct stat_node *l = rb_entry(v, struct stat_node, node);

if (v == SEQ_START_TOKEN)
return session->ts->stat_headers(s);
--
2.9.3