[PATCH] drm/nouveau/client: use rb_entry()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@xxxxxxxxx>
---
 drivers/gpu/drm/nouveau/nvkm/core/client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/core/client.c b/drivers/gpu/drm/nouveau/nvkm/core/client.c
index e194391..ab2ee14 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/client.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/client.c
@@ -221,7 +221,7 @@ nvkm_client_insert(struct nvkm_client *client, struct nvkm_object *object)
 
 	while (*ptr) {
 		struct nvkm_object *this =
-			container_of(*ptr, typeof(*this), node);
+			rb_entry(*ptr, typeof(*this), node);
 		parent = *ptr;
 		if (object->object < this->object)
 			ptr = &parent->rb_left;
@@ -243,7 +243,7 @@ nvkm_client_search(struct nvkm_client *client, u64 handle)
 	struct rb_node *node = client->objroot.rb_node;
 	while (node) {
 		struct nvkm_object *object =
-			container_of(node, typeof(*object), node);
+			rb_entry(node, typeof(*object), node);
 		if (handle < object->object)
 			node = node->rb_left;
 		else
-- 
2.9.3

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux