Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934010AbcLUXXc (ORCPT ); Wed, 21 Dec 2016 18:23:32 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36025 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933512AbcLUXWV (ORCPT ); Wed, 21 Dec 2016 18:22:21 -0500 Subject: Re: [Nouveau] [PATCH] drm/nouveau/dma: use rb_entry() To: Geliang Tang , Ben Skeggs , David Airlie References: <5a188bc5a22daa80cf7a43dc75003b31f9e3abcd.1482203355.git.geliangtang@gmail.com> Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org From: Ben Skeggs Message-ID: Date: Thu, 22 Dec 2016 09:22:14 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <5a188bc5a22daa80cf7a43dc75003b31f9e3abcd.1482203355.git.geliangtang@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OF4lAQs4q55L4kxd34GGSipoiU735nJuS" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3394 Lines: 83 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --OF4lAQs4q55L4kxd34GGSipoiU735nJuS Content-Type: multipart/mixed; boundary="qBavcfdSTqtnxkFriErKQ2Eenvm4DnwSF" From: Ben Skeggs To: Geliang Tang , Ben Skeggs , David Airlie Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Message-ID: Subject: Re: [Nouveau] [PATCH] drm/nouveau/dma: use rb_entry() References: <5a188bc5a22daa80cf7a43dc75003b31f9e3abcd.1482203355.git.geliangtang@gmail.com> In-Reply-To: <5a188bc5a22daa80cf7a43dc75003b31f9e3abcd.1482203355.git.geliangtang@gmail.com> --qBavcfdSTqtnxkFriErKQ2Eenvm4DnwSF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/21/2016 12:02 AM, Geliang Tang wrote: > To make the code clearer, use rb_entry() instead of container_of() to > deal with rbtree. Thanks, I've grabbed the patch. Ben. >=20 > Signed-off-by: Geliang Tang > --- > drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c b/drivers/g= pu/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_cli= ent *client, u64 object) > struct rb_node *node =3D client->dmaroot.rb_node; > while (node) { > struct nvkm_dmaobj *dmaobj =3D > - container_of(node, typeof(*dmaobj), rb); > + rb_entry(node, typeof(*dmaobj), rb); > if (object < dmaobj->handle) > node =3D node->rb_left; > else > @@ -67,7 +67,7 @@ nvkm_dma_oclass_new(struct nvkm_device *device, > dmaobj->handle =3D oclass->object; > =20 > while (*ptr) { > - struct nvkm_dmaobj *obj =3D container_of(*ptr, typeof(*obj), rb); > + struct nvkm_dmaobj *obj =3D rb_entry(*ptr, typeof(*obj), rb); > parent =3D *ptr; > if (dmaobj->handle < obj->handle) > ptr =3D &parent->rb_left; >=20 --qBavcfdSTqtnxkFriErKQ2Eenvm4DnwSF-- --OF4lAQs4q55L4kxd34GGSipoiU735nJuS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEETp/uv2nr9kIVth0/dgucYlCSkfsFAlhbDqYACgkQdgucYlCS kft7Tg/9FxccX2RWfz94zgsRfyOZPYfvqLxMgSYB2CbkpcP3tWCYuSeGMgPmM+v7 8LfxYS1I3CF5RNKGfKzT8mcurTVqyn5N4wniLe58IIShXWzARw+vv1EOSHe+oSMY KLJxSiGBuTGfIWtWaIlphViVUlVJoGYEu6wEODuAdMy0z+JH/QjwhgQ9oZYN4dGZ qvrD/wl+9Cua4kVl8CTa4ECSrI96Gtp/H6SWFB/lEhuw6AiXhxg5vM3KgVvAhsyP LZWJ9uHHiMjPbsgiF7MQmhio5TDh2mKAM8VcFCX3LT+qODEJpEzAbE4tf+cIFN/n vLBSXkTagwDTcnneSM6Iv6YUeWYg0eAV8K0rT+I624gq+2XUwkYTQ1QGeTzWDda+ 4nGMHHJVzNJ6ezGgV0beDgLsVDHAvLZ93rVfKIQMD5nQu0zh+2S+PIwlnFD2JCIs WpGTfnJnK8NxOpDoJkR12KteyrtbxTtbNedZyDxcj4gWLhW7HPUWy+03xvB5Yvr+ RpsF3NqB3gZUNmnVALdS6Fh3vo339L042Kj0GIHd5yERpLyIxGBwsGzfeZ3pAkWX LwjFFcqYr/wzel7c1vMcmCPbpQMICbVeuOIhZxbEzZ4nLQhjzu6gOvwx8gyn+iG2 luLQ225Q02jQg/mufl3LTvdglobKtZDkzrL6YybsztveprpqBe4= =k7c7 -----END PGP SIGNATURE----- --OF4lAQs4q55L4kxd34GGSipoiU735nJuS--