Skip to content

Commit

Permalink
net/mlx4: use rb_entry()
Browse files Browse the repository at this point in the history
To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Geliang Tang authored and David S. Miller committed Jan 22, 2017
1 parent 530cef2 commit 3704eb6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ static void *res_tracker_lookup(struct rb_root *root, u64 res_id)
struct rb_node *node = root->rb_node;

while (node) {
struct res_common *res = container_of(node, struct res_common,
node);
struct res_common *res = rb_entry(node, struct res_common,
node);

if (res_id < res->res_id)
node = node->rb_left;
Expand All @@ -255,8 +255,8 @@ static int res_tracker_insert(struct rb_root *root, struct res_common *res)

/* Figure out where to put new node */
while (*new) {
struct res_common *this = container_of(*new, struct res_common,
node);
struct res_common *this = rb_entry(*new, struct res_common,
node);

parent = *new;
if (res->res_id < this->res_id)
Expand Down

0 comments on commit 3704eb6

Please sign in to comment.