RDMA/qib: use rb_entry()
authorGeliang Tang <geliangtang@gmail.com>
Tue, 20 Dec 2016 14:02:12 +0000 (22:02 +0800)
committerDoug Ledford <dledford@redhat.com>
Thu, 12 Jan 2017 16:38:41 +0000 (11:38 -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>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/qib/qib_user_sdma.c

index 3e0677c512768a7bd79a612fae251f0af70db512..926f3c8eba69fa6e07f86a3777fb0d89fc92d823 100644 (file)
@@ -144,8 +144,8 @@ qib_user_sdma_rb_search(struct rb_root *root, pid_t pid)
        struct rb_node *node = root->rb_node;
 
        while (node) {
-               sdma_rb_node = container_of(node,
-                       struct qib_user_sdma_rb_node, node);
+               sdma_rb_node = rb_entry(node, struct qib_user_sdma_rb_node,
+                                       node);
                if (pid < sdma_rb_node->pid)
                        node = node->rb_left;
                else if (pid > sdma_rb_node->pid)
@@ -164,7 +164,7 @@ qib_user_sdma_rb_insert(struct rb_root *root, struct qib_user_sdma_rb_node *new)
        struct qib_user_sdma_rb_node *got;
 
        while (*node) {
-               got = container_of(*node, struct qib_user_sdma_rb_node, node);
+               got = rb_entry(*node, struct qib_user_sdma_rb_node, node);
                parent = *node;
                if (new->pid < got->pid)
                        node = &((*node)->rb_left);