From patchwork Tue Jul 8 09:41:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Molton X-Patchwork-Id: 4503451 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C834FBEEAA for ; Tue, 8 Jul 2014 09:41:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EDBCA20158 for ; Tue, 8 Jul 2014 09:41:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 224B4202B8 for ; Tue, 8 Jul 2014 09:41:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753998AbaGHJli (ORCPT ); Tue, 8 Jul 2014 05:41:38 -0400 Received: from ducie-dc1.codethink.co.uk ([185.25.241.215]:37476 "EHLO ducie-dc1.codethink.co.uk" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753833AbaGHJlh (ORCPT ); Tue, 8 Jul 2014 05:41:37 -0400 Received: from localhost (localhost [127.0.0.1]) by ducie-dc1.codethink.co.uk (Postfix) with ESMTP id E642B47089F; Tue, 8 Jul 2014 10:41:35 +0100 (BST) X-Virus-Scanned: Debian amavisd-new at ducie-dc1.codethink.co.uk Received: from ducie-dc1.codethink.co.uk ([127.0.0.1]) by localhost (ducie-dc1.codethink.co.uk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WKOrLFTf9Z72; Tue, 8 Jul 2014 10:41:30 +0100 (BST) Received: from snark.dyn.ducie.codethink.co.uk (snark.dyn.ducie.codethink.co.uk [10.24.1.196]) by ducie-dc1.codethink.co.uk (Postfix) with ESMTPS id 354C546EA9E; Tue, 8 Jul 2014 10:41:19 +0100 (BST) Received: from ian by snark.dyn.ducie.codethink.co.uk with local (Exim 4.82) (envelope-from ) id 1X4Rtl-000207-6z; Tue, 08 Jul 2014 10:41:17 +0100 From: Ian Molton To: linux-media@vger.kernel.org Cc: linux-kernel@lists.codethink.co.uk, ian.molton@codethink.co.uk, g.liakhovetski@gmx.de, m.chehab@samsung.com, vladimir.barinov@cogentembedded.com, magnus.damm@gmail.com, horms@verge.net.au, linux-sh@vger.kernel.org Subject: [PATCH 4/4] media: rcar_vin: Clean up rcar_vin_irq Date: Tue, 8 Jul 2014 10:41:14 +0100 Message-Id: <1404812474-7627-5-git-send-email-ian.molton@codethink.co.uk> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1404812474-7627-1-git-send-email-ian.molton@codethink.co.uk> References: <1404812474-7627-1-git-send-email-ian.molton@codethink.co.uk> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch makes the rcar_vin IRQ handler a little more readable. Removes an else clause, and simplifies the buffer handling. Signed-off-by: Ian Molton Reviewed-by: William Towle --- drivers/media/platform/soc_camera/rcar_vin.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c index aeda4e2..a8d2785 100644 --- a/drivers/media/platform/soc_camera/rcar_vin.c +++ b/drivers/media/platform/soc_camera/rcar_vin.c @@ -554,7 +554,6 @@ static irqreturn_t rcar_vin_irq(int irq, void *data) struct rcar_vin_priv *priv = data; u32 int_status; bool can_run = false, hw_stopped; - int slot; unsigned int handled = 0; spin_lock(&priv->lock); @@ -573,17 +572,22 @@ static irqreturn_t rcar_vin_irq(int irq, void *data) hw_stopped = !(ioread32(priv->base + VNMS_REG) & VNMS_CA); if (!priv->request_to_stop) { + struct vb2_buffer **q_entry = priv->queue_buf; + struct vb2_buffer *vb; + if (is_continuous_transfer(priv)) - slot = (ioread32(priv->base + VNMS_REG) & - VNMS_FBS_MASK) >> VNMS_FBS_SHIFT; - else - slot = 0; + q_entry += (ioread32(priv->base + VNMS_REG) & + VNMS_FBS_MASK) >> VNMS_FBS_SHIFT; + + vb = *q_entry; + + vb->v4l2_buf.field = priv->field; + vb->v4l2_buf.sequence = priv->sequence++; + do_gettimeofday(&vb->v4l2_buf.timestamp); + + vb2_buffer_done(vb, VB2_BUF_STATE_DONE); - priv->queue_buf[slot]->v4l2_buf.field = priv->field; - priv->queue_buf[slot]->v4l2_buf.sequence = priv->sequence++; - do_gettimeofday(&priv->queue_buf[slot]->v4l2_buf.timestamp); - vb2_buffer_done(priv->queue_buf[slot], VB2_BUF_STATE_DONE); - priv->queue_buf[slot] = NULL; + *q_entry = NULL; if (priv->state != STOPPING) can_run = rcar_vin_fill_hw_slot(priv);