From patchwork Fri Aug 31 13:18:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 1393291 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5F9DFE0000 for ; Fri, 31 Aug 2012 13:19:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753163Ab2HaNSM (ORCPT ); Fri, 31 Aug 2012 09:18:12 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:52697 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752753Ab2HaNSI (ORCPT ); Fri, 31 Aug 2012 09:18:08 -0400 Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:21e:67ff:fe11:9c5c]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1T7R6t-0002zP-2t; Fri, 31 Aug 2012 15:18:07 +0200 Received: from sha by dude.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1T7R6r-0003XU-TR; Fri, 31 Aug 2012 15:18:05 +0200 From: Sascha Hauer To: linux-media@vger.kernel.org Cc: Pawel Osciak , Mauro Carvalho Chehab , Marek Szyprowski , Sascha Hauer Subject: [PATCH 1/2] media v4l2-mem2mem: Use list_first_entry Date: Fri, 31 Aug 2012 15:18:03 +0200 Message-Id: <1346419084-10879-2-git-send-email-s.hauer@pengutronix.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1346419084-10879-1-git-send-email-s.hauer@pengutronix.de> References: <1346419084-10879-1-git-send-email-s.hauer@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:2:21e:67ff:fe11:9c5c X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use list_first_entry instead of list_entry which makes the intention of the code more clear. Signed-off-by: Sascha Hauer Acked-by: Marek Szyprowski Acked-by: Pawel Osciak --- drivers/media/video/v4l2-mem2mem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/v4l2-mem2mem.c b/drivers/media/video/v4l2-mem2mem.c index 975d0fa..aaa67d3 100644 --- a/drivers/media/video/v4l2-mem2mem.c +++ b/drivers/media/video/v4l2-mem2mem.c @@ -102,7 +102,7 @@ void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx) return NULL; } - b = list_entry(q_ctx->rdy_queue.next, struct v4l2_m2m_buffer, list); + b = list_first_entry(&q_ctx->rdy_queue, struct v4l2_m2m_buffer, list); spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags); return &b->vb; } @@ -122,7 +122,7 @@ void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx) spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags); return NULL; } - b = list_entry(q_ctx->rdy_queue.next, struct v4l2_m2m_buffer, list); + b = list_first_entry(&q_ctx->rdy_queue, struct v4l2_m2m_buffer, list); list_del(&b->list); q_ctx->num_rdy--; spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags); @@ -175,7 +175,7 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev) return; } - m2m_dev->curr_ctx = list_entry(m2m_dev->job_queue.next, + m2m_dev->curr_ctx = list_first_entry(&m2m_dev->job_queue, struct v4l2_m2m_ctx, queue); m2m_dev->curr_ctx->job_flags |= TRANS_RUNNING; spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags);