[media] vb2: call buf_finish from __queue_cancel

If a queue was canceled, then the buf_finish op was never called for the
pending buffers. So add this call to queue_cancel. Before calling buf_finish
set the buffer state to PREPARED, which is the correct state. That way the
states DONE and ERROR will only be seen in buf_finish if streaming is in
progress.

Since buf_finish can now be called from non-streaming state we need to
adapt the handful of drivers that actually need to know this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
Hans Verkuil
2014-03-04 07:34:49 -03:00
committed by Mauro Carvalho Chehab
parent 1a17948184
commit 9c0863b1cc
5 changed files with 31 additions and 5 deletions

View File

@@ -113,7 +113,8 @@ static void uvc_buffer_finish(struct vb2_buffer *vb)
container_of(queue, struct uvc_streaming, queue);
struct uvc_buffer *buf = container_of(vb, struct uvc_buffer, buf);
uvc_video_clock_update(stream, &vb->v4l2_buf, buf);
if (vb->state == VB2_BUF_STATE_DONE)
uvc_video_clock_update(stream, &vb->v4l2_buf, buf);
}
static void uvc_wait_prepare(struct vb2_queue *vq)