]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/nouveau/dma: use rb_entry()
authorGeliang Tang <geliangtang@gmail.com>
Tue, 20 Dec 2016 14:02:11 +0000 (22:02 +0800)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 17 Feb 2017 05:14:55 +0000 (15:14 +1000)
To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c

index f11ebdd16c77f0a8516d01336bef6837f660eea6..4655d1750b9518135882e7de79111b3cd3a9f16e 100644 (file)
@@ -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;