提交 3704eb6f 编写于 作者: G Geliang Tang 提交者: David S. Miller

net/mlx4: use rb_entry()

To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.
Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
Reviewed-by: NLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 530cef21
...@@ -236,8 +236,8 @@ static void *res_tracker_lookup(struct rb_root *root, u64 res_id) ...@@ -236,8 +236,8 @@ static void *res_tracker_lookup(struct rb_root *root, u64 res_id)
struct rb_node *node = root->rb_node; struct rb_node *node = root->rb_node;
while (node) { while (node) {
struct res_common *res = container_of(node, struct res_common, struct res_common *res = rb_entry(node, struct res_common,
node); node);
if (res_id < res->res_id) if (res_id < res->res_id)
node = node->rb_left; node = node->rb_left;
...@@ -255,8 +255,8 @@ static int res_tracker_insert(struct rb_root *root, struct res_common *res) ...@@ -255,8 +255,8 @@ static int res_tracker_insert(struct rb_root *root, struct res_common *res)
/* Figure out where to put new node */ /* Figure out where to put new node */
while (*new) { while (*new) {
struct res_common *this = container_of(*new, struct res_common, struct res_common *this = rb_entry(*new, struct res_common,
node); node);
parent = *new; parent = *new;
if (res->res_id < this->res_id) if (res->res_id < this->res_id)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册