Skip to content

Commit 1013fe3

Browse files
geliangtangKAGA-KOKO
authored andcommitted
x86/mm/pat: Use rb_entry()
To make the code clearer, use rb_entry() instead of open coding it Signed-off-by: Geliang Tang <geliangtang@gmail.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Toshi Kani <toshi.kani@hpe.com> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Link: http://lkml.kernel.org/r/974a91cd4ed2d04c92e4faa4765077e38f248d6b.1482157956.git.geliangtang@gmail.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent e64d5fb commit 1013fe3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arch/x86/mm/pat_rbtree.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static u64 get_subtree_max_end(struct rb_node *node)
4747
{
4848
u64 ret = 0;
4949
if (node) {
50-
struct memtype *data = container_of(node, struct memtype, rb);
50+
struct memtype *data = rb_entry(node, struct memtype, rb);
5151
ret = data->subtree_max_end;
5252
}
5353
return ret;
@@ -79,7 +79,7 @@ static struct memtype *memtype_rb_lowest_match(struct rb_root *root,
7979
struct memtype *last_lower = NULL;
8080

8181
while (node) {
82-
struct memtype *data = container_of(node, struct memtype, rb);
82+
struct memtype *data = rb_entry(node, struct memtype, rb);
8383

8484
if (get_subtree_max_end(node->rb_left) > start) {
8585
/* Lowest overlap if any must be on left side */
@@ -121,7 +121,7 @@ static struct memtype *memtype_rb_match(struct rb_root *root,
121121

122122
node = rb_next(&match->rb);
123123
if (node)
124-
match = container_of(node, struct memtype, rb);
124+
match = rb_entry(node, struct memtype, rb);
125125
else
126126
match = NULL;
127127
}
@@ -150,7 +150,7 @@ static int memtype_rb_check_conflict(struct rb_root *root,
150150

151151
node = rb_next(&match->rb);
152152
while (node) {
153-
match = container_of(node, struct memtype, rb);
153+
match = rb_entry(node, struct memtype, rb);
154154

155155
if (match->start >= end) /* Checked all possible matches */
156156
goto success;
@@ -181,7 +181,7 @@ static void memtype_rb_insert(struct rb_root *root, struct memtype *newdata)
181181
struct rb_node *parent = NULL;
182182

183183
while (*node) {
184-
struct memtype *data = container_of(*node, struct memtype, rb);
184+
struct memtype *data = rb_entry(*node, struct memtype, rb);
185185

186186
parent = *node;
187187
if (data->subtree_max_end < newdata->end)
@@ -270,7 +270,7 @@ int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos)
270270
}
271271

272272
if (node) { /* pos == i */
273-
struct memtype *this = container_of(node, struct memtype, rb);
273+
struct memtype *this = rb_entry(node, struct memtype, rb);
274274
*out = *this;
275275
return 0;
276276
} else {

0 commit comments

Comments
 (0)