net/mlx5: use rb_entry()
authorGeliang Tang <geliangtang@gmail.com>
Tue, 20 Dec 2016 14:02:14 +0000 (22:02 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Dec 2016 19:22:48 +0000 (14:22 -0500)
To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Acked-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c

index 3b026c151cf24f370137b4655b417d6e024d6dec..7431f633de3135f5ccee6a9f506892d5f13dff35 100644 (file)
@@ -75,7 +75,7 @@ static void mlx5_fc_stats_insert(struct rb_root *root, struct mlx5_fc *counter)
        struct rb_node *parent = NULL;
 
        while (*new) {
-               struct mlx5_fc *this = container_of(*new, struct mlx5_fc, node);
+               struct mlx5_fc *this = rb_entry(*new, struct mlx5_fc, node);
                int result = counter->id - this->id;
 
                parent = *new;