[media] vb2: return ENOBUFS in start_streaming in case of too few buffers
authorHans Verkuil <hans.verkuil@cisco.com>
Fri, 13 Dec 2013 16:13:44 +0000 (13:13 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Tue, 7 Jan 2014 09:13:49 +0000 (07:13 -0200)
This works together with the retry_start_streaming mechanism to allow userspace
to start streaming even if not all required buffers have been queued.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Cc: Tomasz Stanislawski <t.stanislaws@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Kamil Debski <k.debski@samsung.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/davinci/vpbe_display.c
drivers/media/platform/davinci/vpif_capture.c
drivers/media/platform/davinci/vpif_display.c
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
drivers/media/platform/s5p-tv/mixer_video.c
drivers/media/platform/soc_camera/mx2_camera.c
drivers/staging/media/davinci_vpfe/vpfe_video.c

index eac472b5ae83baf0cdefb0fb2920a1e99b925094..b02aba48882632661962aa52380248409a8457d4 100644 (file)
@@ -347,7 +347,7 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count)
        /* If buffer queue is empty, return error */
        if (list_empty(&layer->dma_queue)) {
                v4l2_err(&vpbe_dev->v4l2_dev, "buffer queue is empty\n");
-               return -EINVAL;
+               return -ENOBUFS;
        }
        /* Get the next frame from the buffer queue */
        layer->next_frm = layer->cur_frm = list_entry(layer->dma_queue.next,
index 52ac5e6c86254d0bd7ba5a4dadee4ba6ca70d08e..735ec47601a9c3241e790315e46efbc437668e56 100644 (file)
@@ -277,7 +277,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
        if (list_empty(&common->dma_queue)) {
                spin_unlock_irqrestore(&common->irqlock, flags);
                vpif_dbg(1, debug, "buffer queue is empty\n");
-               return -EIO;
+               return -ENOBUFS;
        }
 
        /* Get the next frame from the buffer queue */
index c31bcf129a5de08122744d7ad0dae956440a5385..9d115cdc6bdbfdbfc7b1a655346d6a2ad3a13d7e 100644 (file)
@@ -239,7 +239,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
        if (list_empty(&common->dma_queue)) {
                spin_unlock_irqrestore(&common->irqlock, flags);
                vpif_err("buffer queue is empty\n");
-               return -EIO;
+               return -ENOBUFS;
        }
 
        /* Get the next frame from the buffer queue */
index 4ff3b6cd684274a33f14bbce053657db4237f220..f0b41f85ac71a02f3ca81f20a92e65a485b8c706 100644 (file)
@@ -1863,7 +1863,7 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count)
                if (ctx->src_bufs_cnt < ctx->pb_count) {
                        mfc_err("Need minimum %d OUTPUT buffers\n",
                                        ctx->pb_count);
-                       return -EINVAL;
+                       return -ENOBUFS;
                }
        }
 
index 81b97db111d8506a1c28df84a86ce4181f6ddccb..c5059ba0d733d9f819a6af1b55f57c47c31fe756 100644 (file)
@@ -948,7 +948,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
 
        if (count == 0) {
                mxr_dbg(mdev, "no output buffers queued\n");
-               return -EINVAL;
+               return -ENOBUFS;
        }
 
        /* block any changes in output configuration */
index 45a0276be4e599f15d2fef8f05a67b6e2655e184..d73abca9c6eeda21028dbddcab4410492ec28ae4 100644 (file)
@@ -659,7 +659,7 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count)
        unsigned long flags;
 
        if (count < 2)
-               return -EINVAL;
+               return -ENOBUFS;
 
        spin_lock_irqsave(&pcdev->lock, flags);
 
index 3b036bef8c437beddc4f6a124298368af839d7c7..1f3b0f9a8d102e2852603dc376c79b79ceae9323 100644 (file)
@@ -1201,6 +1201,8 @@ static int vpfe_start_streaming(struct vb2_queue *vq, unsigned int count)
        unsigned long addr;
        int ret;
 
+       if (count == 0)
+               return -ENOBUFS;
        ret = mutex_lock_interruptible(&video->lock);
        if (ret)
                goto streamoff;