dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Skeggs <skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Geliang Tang
	<geliangtang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	David Airlie <airlied-cv59FeDIM0c@public.gmane.org>
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] drm/nouveau/dma: use rb_entry()
Date: Thu, 22 Dec 2016 09:22:14 +1000	[thread overview]
Message-ID: <f5c3fb4b-ba2a-daab-9654-57ca4c35ca49@gmail.com> (raw)
In-Reply-To: <5a188bc5a22daa80cf7a43dc75003b31f9e3abcd.1482203355.git.geliangtang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 1391 bytes --]

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.

> 
> Signed-off-by: Geliang Tang <geliangtang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  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;
> 


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

      parent reply	other threads:[~2016-12-21 23:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ddabc96c798df194791134d8e070d728e2a7b59f.1482203698.git.geliangtang@gmail.com>
2016-12-20 14:02 ` [PATCH] drm/nouveau/dma: use rb_entry() Geliang Tang
     [not found]   ` <5a188bc5a22daa80cf7a43dc75003b31f9e3abcd.1482203355.git.geliangtang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-21 23:22     ` Ben Skeggs [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5c3fb4b-ba2a-daab-9654-57ca4c35ca49@gmail.com \
    --to=skeggsb-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=geliangtang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox