aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2014-08-31 06:19:21 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-09-21 19:13:41 -0400
commitb7900eedfb393dcea9794fbb6d57e4d43338a16b (patch)
tree74abf66faf285134569ab25508171b940782024d
parent12561ad622de254d69ec1baaf6734afc602a2c30 (diff)
[media] videobuf: Allow reqbufs(0) to free current buffers
All the infrastructure for this is already there, and despite our desires for the old videobuf code to go away, it is currently still in use in 18 drivers. Allowing reqbufs(0) makes these drivers behave consistent with modern drivers, making live easier for userspace, see e.g. : https://bugzilla.gnome.org/show_bug.cgi?id=735660 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/v4l2-core/videobuf-core.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/media/v4l2-core/videobuf-core.c b/drivers/media/v4l2-core/videobuf-core.c
index fb5ee5dd8fe9..b91a266d0b7e 100644
--- a/drivers/media/v4l2-core/videobuf-core.c
+++ b/drivers/media/v4l2-core/videobuf-core.c
@@ -441,11 +441,6 @@ int videobuf_reqbufs(struct videobuf_queue *q,
441 unsigned int size, count; 441 unsigned int size, count;
442 int retval; 442 int retval;
443 443
444 if (req->count < 1) {
445 dprintk(1, "reqbufs: count invalid (%d)\n", req->count);
446 return -EINVAL;
447 }
448
449 if (req->memory != V4L2_MEMORY_MMAP && 444 if (req->memory != V4L2_MEMORY_MMAP &&
450 req->memory != V4L2_MEMORY_USERPTR && 445 req->memory != V4L2_MEMORY_USERPTR &&
451 req->memory != V4L2_MEMORY_OVERLAY) { 446 req->memory != V4L2_MEMORY_OVERLAY) {
@@ -471,6 +466,12 @@ int videobuf_reqbufs(struct videobuf_queue *q,
471 goto done; 466 goto done;
472 } 467 }
473 468
469 if (req->count == 0) {
470 dprintk(1, "reqbufs: count invalid (%d)\n", req->count);
471 retval = __videobuf_free(q);
472 goto done;
473 }
474
474 count = req->count; 475 count = req->count;
475 if (count > VIDEO_MAX_FRAME) 476 if (count > VIDEO_MAX_FRAME)
476 count = VIDEO_MAX_FRAME; 477 count = VIDEO_MAX_FRAME;