diff mbox

[v1,2/2] v4l: vivi: adapt to out-of-order buffer dequeuing in videobuf.

Message ID 1271866235-14370-3-git-send-email-p.osciak@samsung.com (mailing list archive)
State RFC
Headers show

Commit Message

Pawel Osciak April 21, 2010, 4:10 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index cdbe703..4a91761 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -630,13 +630,13 @@  static void vivi_thread_tick(struct vivi_fh *fh)
 		goto unlock;
 	}
 
-	buf = list_entry(dma_q->active.next,
-			 struct vivi_buffer, vb.queue);
-
-	/* Nobody is waiting on this buffer, return */
-	if (!waitqueue_active(&buf->vb.done))
+	if (!videobuf_has_consumers(&fh->vb_vidq)) {
+		dprintk(dev, 1, "No consumers\n");
 		goto unlock;
+	}
 
+	buf = list_entry(dma_q->active.next,
+			 struct vivi_buffer, vb.queue);
 	list_del(&buf->vb.queue);
 
 	do_gettimeofday(&buf->vb.ts);
@@ -645,11 +645,12 @@  static void vivi_thread_tick(struct vivi_fh *fh)
 	vivi_fillbuff(fh, buf);
 	dprintk(dev, 1, "filled buffer %p\n", buf);
 
-	wake_up(&buf->vb.done);
-	dprintk(dev, 2, "[%p/%d] wakeup\n", buf, buf->vb. i);
-unlock:
 	spin_unlock_irqrestore(&dev->slock, flags);
+	videobuf_buf_finish(&fh->vb_vidq, &buf->vb);
 	return;
+
+unlock:
+	spin_unlock_irqrestore(&dev->slock, flags);
 }
 
 #define frames_to_ms(frames)					\