@@ -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);