Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935051AbcLTOL2 (ORCPT ); Tue, 20 Dec 2016 09:11:28 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:32863 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934218AbcLTOLV (ORCPT ); Tue, 20 Dec 2016 09:11:21 -0500 From: Geliang Tang To: Ben Skeggs , David Airlie Cc: Geliang Tang , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/nouveau/dma: use rb_entry() Date: Tue, 20 Dec 2016 22:02:11 +0800 Message-Id: <5a188bc5a22daa80cf7a43dc75003b31f9e3abcd.1482203355.git.geliangtang@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1187 Lines: 32 To make the code clearer, use rb_entry() instead of container_of() to deal with rbtree. Signed-off-by: Geliang Tang --- 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