lkml.org 
[lkml]   [2016]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] trace/trace_stat: use rb_entry()
Date
To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.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
\
 
 \ /
  Last update: 2016-12-19 16:10    [W:0.051 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site