Commit 05073cae authored by Geliang Tang's avatar Geliang Tang Committed by Ben Skeggs

drm/nouveau/dma: use rb_entry()

To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.
Signed-off-by: default avatarGeliang Tang <geliangtang@gmail.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent af7db03e
...@@ -34,7 +34,7 @@ nvkm_dma_search(struct nvkm_dma *dma, struct nvkm_client *client, u64 object) ...@@ -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; struct rb_node *node = client->dmaroot.rb_node;
while (node) { while (node) {
struct nvkm_dmaobj *dmaobj = struct nvkm_dmaobj *dmaobj =
container_of(node, typeof(*dmaobj), rb); rb_entry(node, typeof(*dmaobj), rb);
if (object < dmaobj->handle) if (object < dmaobj->handle)
node = node->rb_left; node = node->rb_left;
else else
...@@ -67,7 +67,7 @@ nvkm_dma_oclass_new(struct nvkm_device *device, ...@@ -67,7 +67,7 @@ nvkm_dma_oclass_new(struct nvkm_device *device,
dmaobj->handle = oclass->object; dmaobj->handle = oclass->object;
while (*ptr) { while (*ptr) {
struct nvkm_dmaobj *obj = container_of(*ptr, typeof(*obj), rb); struct nvkm_dmaobj *obj = rb_entry(*ptr, typeof(*obj), rb);
parent = *ptr; parent = *ptr;
if (dmaobj->handle < obj->handle) if (dmaobj->handle < obj->handle)
ptr = &parent->rb_left; ptr = &parent->rb_left;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment