From patchwork Mon Feb 13 13:51:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martin X-Patchwork-Id: 9865 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1RwwKG-0000pL-Dr for patchwork@linuxtv.org; Mon, 13 Feb 2012 14:52:16 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-4) with esmtp for id 1RwwKF-00043D-C8; Mon, 13 Feb 2012 14:52:16 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756529Ab2BMNwM (ORCPT ); Mon, 13 Feb 2012 08:52:12 -0500 Received: from mail-ww0-f44.google.com ([74.125.82.44]:41716 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751236Ab2BMNwJ (ORCPT ); Mon, 13 Feb 2012 08:52:09 -0500 Received: by wgbdt10 with SMTP id dt10so4927974wgb.1 for ; Mon, 13 Feb 2012 05:52:08 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.90.194 with SMTP id by2mr24614992wib.5.1329141128159; Mon, 13 Feb 2012 05:52:08 -0800 (PST) Received: from localhost.localdomain (182.50.18.95.dynamic.jazztel.es. [95.18.50.182]) by mx.google.com with ESMTPS id eq5sm46989029wib.2.2012.02.13.05.52.06 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 13 Feb 2012 05:52:07 -0800 (PST) From: Javier Martin To: linux-media@vger.kernel.org Cc: g.liakhovetski@gmx.de, mchehab@infradead.org, s.hauer@pengutronix.de, Javier Martin Subject: [PATCH 2/6] media: i.MX27 camera: Use list_first_entry() whenever possible. Date: Mon, 13 Feb 2012 14:51:51 +0100 Message-Id: <1329141115-23133-3-git-send-email-javier.martin@vista-silicon.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1329141115-23133-1-git-send-email-javier.martin@vista-silicon.com> References: <1329141115-23133-1-git-send-email-javier.martin@vista-silicon.com> X-Gm-Message-State: ALoCoQmFgphBFiRS/B6u6hSd5lBwJPn7EgdL5b9bbn4fdp3Ae9tefL3G3GVRuNg0RuDq9zLeTl+3 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.2.13.134523 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' Signed-off-by: Javier Martin --- drivers/media/video/mx2_camera.c | 28 +++++++++++++--------------- 1 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 1f046a3..13be305 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c @@ -458,7 +458,7 @@ static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb, buf = NULL; writel(0, pcdev->base_csi + fb_reg); } else { - buf = list_entry(pcdev->capture.next, struct mx2_buffer, + buf = list_first_entry(&pcdev->capture, struct mx2_buffer, queue); vb = &buf->vb; list_del(&buf->queue); @@ -718,8 +718,8 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count) spin_lock_irqsave(&pcdev->lock, flags); - buf = list_entry(pcdev->capture.next, - struct mx2_buffer, queue); + buf = list_first_entry(&pcdev->capture, struct mx2_buffer, + queue); buf->bufnum = 0; vb = &buf->vb; buf->state = MX2_STATE_ACTIVE; @@ -728,8 +728,8 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count) mx27_update_emma_buf(pcdev, phys, buf->bufnum); list_move_tail(pcdev->capture.next, &pcdev->active_bufs); - buf = list_entry(pcdev->capture.next, - struct mx2_buffer, queue); + buf = list_first_entry(&pcdev->capture, struct mx2_buffer, + queue); buf->bufnum = 1; vb = &buf->vb; buf->state = MX2_STATE_ACTIVE; @@ -1215,8 +1215,7 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev, struct vb2_buffer *vb; unsigned long phys; - buf = list_entry(pcdev->active_bufs.next, - struct mx2_buffer, queue); + buf = list_first_entry(&pcdev->active_bufs, struct mx2_buffer, queue); BUG_ON(buf->bufnum != bufnum); @@ -1270,8 +1269,8 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev, return; } - buf = list_entry(pcdev->discard.next, - struct mx2_buffer, queue); + buf = list_first_entry(&pcdev->discard, struct mx2_buffer, + queue); buf->bufnum = bufnum; list_move_tail(pcdev->discard.next, &pcdev->active_bufs); @@ -1279,8 +1278,7 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev, return; } - buf = list_entry(pcdev->capture.next, - struct mx2_buffer, queue); + buf = list_first_entry(&pcdev->capture, struct mx2_buffer, queue); buf->bufnum = bufnum; @@ -1309,8 +1307,8 @@ static irqreturn_t mx27_camera_emma_irq(int irq_emma, void *data) } if (status & (1 << 7)) { /* overflow */ - buf = list_entry(pcdev->active_bufs.next, - struct mx2_buffer, queue); + buf = list_first_entry(&pcdev->active_bufs, struct mx2_buffer, + queue); mx27_camera_frame_done_emma(pcdev, buf->bufnum, true); status &= ~(1 << 7); @@ -1320,8 +1318,8 @@ static irqreturn_t mx27_camera_emma_irq(int irq_emma, void *data) * Both buffers have triggered, process the one we're expecting * to first */ - buf = list_entry(pcdev->active_bufs.next, - struct mx2_buffer, queue); + buf = list_first_entry(&pcdev->active_bufs, struct mx2_buffer, + queue); mx27_camera_frame_done_emma(pcdev, buf->bufnum, false); status &= ~(1 << (6 - buf->bufnum)); /* mark processed */ } else if ((status & (1 << 6)) || (status & (1 << 4))) {