From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934568AbcLTKBN (ORCPT ); Tue, 20 Dec 2016 05:01:13 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35744 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934266AbcLTKBL (ORCPT ); Tue, 20 Dec 2016 05:01:11 -0500 Date: Tue, 20 Dec 2016 11:01:06 +0100 From: Daniel Vetter To: Geliang Tang Cc: Daniel Vetter , Jani Nikula , David Airlie , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH] drm/i915/debugfs: use rb_entry() Message-ID: <20161220100106.5jt5vfnorhl5sv4y@phenom.ffwll.local> Mail-Followup-To: Geliang Tang , Daniel Vetter , Jani Nikula , David Airlie , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <62ce937ae9a341421942b4418515610d055fa653.1482158544.git.geliangtang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <62ce937ae9a341421942b4418515610d055fa653.1482158544.git.geliangtang@gmail.com> X-Operating-System: Linux phenom 4.8.0-1-amd64 User-Agent: NeoMutt/20161126 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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