[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <22da087ad757fafdb206fd0c57d286449302acdb.1484816560.git.geliangtang@gmail.com>
Date: Fri, 20 Jan 2017 22:36:56 +0800
From: Geliang Tang <geliangtang@...il.com>
To: Ben Skeggs <bskeggs@...hat.com>, David Airlie <airlied@...ux.ie>
Cc: Geliang Tang <geliangtang@...il.com>,
dri-devel@...ts.freedesktop.org, nouveau@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] drm/nouveau/client: use rb_entry()
To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.
Signed-off-by: Geliang Tang <geliangtang@...il.com>
---
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
Powered by blists - more mailing lists