aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/generic.c
diff options
context:
space:
mode:
authorGeliang Tang <[email protected]>2017-02-24 23:00:17 +0000
committerLinus Torvalds <[email protected]>2017-02-25 01:46:56 +0000
commit4e4a7fb7b4574b4074e4097561c2e34a7333306f (patch)
treebdb1d6939a8c42d058e2e62a9a4f418e75ccd0f6 /fs/proc/generic.c
parentalpha: use generic current.h (diff)
downloadkernel-4e4a7fb7b4574b4074e4097561c2e34a7333306f.tar.gz
kernel-4e4a7fb7b4574b4074e4097561c2e34a7333306f.zip
proc: use rb_entry()
To make the code clearer, use rb_entry() instead of container_of() to deal with rbtree. Link: http://lkml.kernel.org/r/4fd1f82818665705ce75c5156a060ae7caa8e0a9.1482160150.git.geliangtang@gmail.com Signed-off-by: Geliang Tang <[email protected]> Cc: Jan Kara <[email protected]> Cc: Al Viro <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Juergen Gross <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Seth Forshee <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r--fs/proc/generic.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index f6a01f09f79d..06c73904d497 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -57,9 +57,9 @@ static struct proc_dir_entry *pde_subdir_find(struct proc_dir_entry *dir,
struct rb_node *node = dir->subdir.rb_node;
while (node) {
- struct proc_dir_entry *de = container_of(node,
- struct proc_dir_entry,
- subdir_node);
+ struct proc_dir_entry *de = rb_entry(node,
+ struct proc_dir_entry,
+ subdir_node);
int result = proc_match(len, name, de);
if (result < 0)
@@ -80,8 +80,9 @@ static bool pde_subdir_insert(struct proc_dir_entry *dir,
/* Figure out where to put new node */
while (*new) {
- struct proc_dir_entry *this =
- container_of(*new, struct proc_dir_entry, subdir_node);
+ struct proc_dir_entry *this = rb_entry(*new,
+ struct proc_dir_entry,
+ subdir_node);
int result = proc_match(de->namelen, de->name, this);
parent = *new;