diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2014-06-04 02:25:06 +0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-17 23:22:41 +0400 |
commit | cb766937e36fc651ad8e8f61e0a8be323140ef75 (patch) | |
tree | 1588124ccee2c9e173ae0c7a3e805ff673fe4db4 /drivers/staging/media/omap4iss/iss_video.c | |
parent | 1153be56a10576abc3dd2a89aee59debb4dcc2b6 (diff) | |
download | linux-cb766937e36fc651ad8e8f61e0a8be323140ef75.tar.xz |
[media] v4l: omap4iss: Signal fatal errors to the vb2 queue
When a fatal error occurs in the pipeline signal it to the vb2 queue
with a call to vb2_queue_error(). The queue will then take care to
return -EIO when preparing buffers, remove the driver-specific code that
now duplicates that check.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/staging/media/omap4iss/iss_video.c')
-rw-r--r-- | drivers/staging/media/omap4iss/iss_video.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c index 61b974ac4c13..943b5b09c632 100644 --- a/drivers/staging/media/omap4iss/iss_video.c +++ b/drivers/staging/media/omap4iss/iss_video.c @@ -331,15 +331,6 @@ static int iss_video_buf_prepare(struct vb2_buffer *vb) if (vb2_plane_size(vb, 0) < size) return -ENOBUFS; - /* Refuse to prepare the buffer is the video node has registered an - * error. We don't need to take any lock here as the operation is - * inherently racy. The authoritative check will be performed in the - * queue handler, which can't return an error, this check is just a best - * effort to notify userspace as early as possible. - */ - if (unlikely(video->error)) - return -EIO; - addr = vb2_dma_contig_plane_dma_addr(vb, 0); if (!IS_ALIGNED(addr, 32)) { dev_dbg(video->iss->dev, @@ -363,6 +354,11 @@ static void iss_video_buf_queue(struct vb2_buffer *vb) spin_lock_irqsave(&video->qlock, flags); + /* Mark the buffer is faulty and give it back to the queue immediately + * if the video node has registered an error. vb2 will perform the same + * check when preparing the buffer, but that is inherently racy, so we + * need to handle the race condition with an authoritative check here. + */ if (unlikely(video->error)) { vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); spin_unlock_irqrestore(&video->qlock, flags); @@ -513,6 +509,7 @@ void omap4iss_video_cancel_stream(struct iss_video *video) vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); } + vb2_queue_error(video->queue); video->error = true; spin_unlock_irqrestore(&video->qlock, flags); |