[PATCH] drm/nouveau/dma: 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/engine/dma/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c
index f11ebdd..4655d17 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c
@@ -34,7 +34,7 @@ nvkm_dma_search(struct nvkm_dma *dma, struct nvkm_client *client, u64 object)
 	struct rb_node *node = client->dmaroot.rb_node;
 	while (node) {
 		struct nvkm_dmaobj *dmaobj =
-			container_of(node, typeof(*dmaobj), rb);
+			rb_entry(node, typeof(*dmaobj), rb);
 		if (object < dmaobj->handle)
 			node = node->rb_left;
 		else
@@ -67,7 +67,7 @@ nvkm_dma_oclass_new(struct nvkm_device *device,
 	dmaobj->handle = oclass->object;
 
 	while (*ptr) {
-		struct nvkm_dmaobj *obj = container_of(*ptr, typeof(*obj), rb);
+		struct nvkm_dmaobj *obj = rb_entry(*ptr, typeof(*obj), rb);
 		parent = *ptr;
 		if (dmaobj->handle < obj->handle)
 			ptr = &parent->rb_left;
-- 
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