linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Molton <ian.molton@codethink.co.uk>
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, 08 Jul 2014 09:41:14 +0000	[thread overview]
Message-ID: <1404812474-7627-5-git-send-email-ian.molton@codethink.co.uk> (raw)
In-Reply-To: <1404812474-7627-1-git-send-email-ian.molton@codethink.co.uk>

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 <ian.molton@codethink.co.uk>
Reviewed-by: William Towle <william.towle@codethink.co.uk>
---
 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);
-- 
1.9.1


  parent reply	other threads:[~2014-07-08  9:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08  9:41 Resend: [PATCH 0/4] rcar_vin: fix soc_camera WARN_ON() issues Ian Molton
2014-07-08  9:41 ` [PATCH 1/4] media: rcar_vin: Dont aggressively retire buffers Ian Molton
2014-07-08  9:41 ` [PATCH 2/4] media: rcar_vin: Ensure all in-flight buffers are returned to error state before stoppin Ian Molton
2014-08-04 20:39   ` [PATCH 2/4] media: rcar_vin: Ensure all in-flight buffers are returned to error state before sto Sergei Shtylyov
2014-08-13 17:30     ` Ian Molton
2014-08-13 17:35       ` Sergei Shtylyov
2014-09-20  6:59       ` Guennadi Liakhovetski
2014-08-04 21:22   ` Hans Verkuil
2015-01-18 20:32     ` Guennadi Liakhovetski
2014-07-08  9:41 ` [PATCH 3/4] media: rcar_vin: Fix race condition terminating stream Ian Molton
2014-07-08 16:09   ` Sergei Shtylyov
2014-07-09  8:16     ` Simon Horman
2014-07-10 10:15     ` Ian Molton
2014-08-01 22:16       ` Sergei Shtylyov
2014-08-04 21:27   ` Hans Verkuil
2014-08-11 11:23     ` Ian Molton
2014-08-11 12:14       ` Hans Verkuil
2014-07-08  9:41 ` Ian Molton [this message]
2014-08-04 20:00 ` Resend: [PATCH 0/4] rcar_vin: fix soc_camera WARN_ON() issues Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404812474-7627-5-git-send-email-ian.molton@codethink.co.uk \
    --to=ian.molton@codethink.co.uk \
    --cc=g.liakhovetski@gmx.de \
    --cc=horms@verge.net.au \
    --cc=linux-kernel@lists.codethink.co.uk \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=magnus.damm@gmail.com \
    --cc=vladimir.barinov@cogentembedded.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).