Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1545021

Re: [PATCH] drm/i915/debugfs: use rb_entry()

From Daniel Vetter <daniel@ffwll.ch>
Newsgroups linux.kernel
Subject Re: [PATCH] drm/i915/debugfs: use rb_entry()
Date 2016-12-20 11:10 +0100
Message-ID <sQpwS-4cL-13@gated-at.bofh.it> (permalink)
References <sQ7zY-ML-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Dec 19, 2016 at 10:43:49PM +0800, Geliang Tang wrote:
> To make the code clearer, use rb_entry() instead of container_of() to
> deal with rbtree.
> 
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>

Not sure a direct alias for container_of is all that useful, but we have
list_entry too ...

Queued up for 4.11, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index b77b53b..e04d9a1 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -686,7 +686,7 @@ static void i915_ring_seqno_info(struct seq_file *m,
>  
>  	spin_lock_irq(&b->lock);
>  	for (rb = rb_first(&b->waiters); rb; rb = rb_next(rb)) {
> -		struct intel_wait *w = container_of(rb, typeof(*w), node);
> +		struct intel_wait *w = rb_entry(rb, typeof(*w), node);
>  
>  		seq_printf(m, "Waiting (%s): %s [%d] on %x\n",
>  			   engine->name, w->tsk->comm, w->tsk->pid, w->seqno);
> @@ -1336,7 +1336,7 @@ static int i915_hangcheck_info(struct seq_file *m, void *unused)
>  					  &dev_priv->gpu_error.missed_irq_rings)));
>  		spin_lock_irq(&b->lock);
>  		for (rb = rb_first(&b->waiters); rb; rb = rb_next(rb)) {
> -			struct intel_wait *w = container_of(rb, typeof(*w), node);
> +			struct intel_wait *w = rb_entry(rb, typeof(*w), node);
>  
>  			seq_printf(m, "\t%s [%d] waiting for %x\n",
>  				   w->tsk->comm, w->tsk->pid, w->seqno);
> @@ -3252,7 +3252,7 @@ static int i915_engine_info(struct seq_file *m, void *unused)
>  
>  		spin_lock_irq(&b->lock);
>  		for (rb = rb_first(&b->waiters); rb; rb = rb_next(rb)) {
> -			struct intel_wait *w = container_of(rb, typeof(*w), node);
> +			struct intel_wait *w = rb_entry(rb, typeof(*w), node);
>  
>  			seq_printf(m, "\t%s [%d] waiting for %x\n",
>  				   w->tsk->comm, w->tsk->pid, w->seqno);
> -- 
> 2.9.3
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] drm/i915/debugfs: use rb_entry() Geliang Tang <geliangtang@gmail.com> - 2016-12-19 16:00 +0100
  Re: [PATCH] drm/i915/debugfs: use rb_entry() Daniel Vetter <daniel@ffwll.ch> - 2016-12-20 11:10 +0100

csiph-web