[<prev] [next>] [day] [month] [year] [list]
Message-Id: <956e0bb8410c5c42b43a09484193a7f6ae9c22ed.1482159888.git.geliangtang@gmail.com>
Date: Mon, 19 Dec 2016 23:05:38 +0800
From: Geliang Tang <geliangtang@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>
Cc: Geliang Tang <geliangtang@...il.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] trace/trace_stat: use rb_entry()
To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.
Signed-off-by: Geliang Tang <geliangtang@...il.com>
---
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
Powered by blists - more mailing lists