Commit 84c1b09495ea366276726b0df2dcd7898cda9d0f

Authored by Hans Verkuil
Committed by Mauro Carvalho Chehab
1 parent 5ca75b00ff

V4L/DVB (10713): zoran: if reqbufs is called with count == 0, do a streamoff.

count == 0 has a special meaning, implement this.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff

drivers/media/video/zoran/zoran_driver.c
... ... @@ -2493,6 +2493,8 @@
2493 2493 return res;
2494 2494 }
2495 2495  
  2496 +static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type type);
  2497 +
2496 2498 static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffers *req)
2497 2499 {
2498 2500 struct zoran_fh *fh = __fh;
2499 2501  
2500 2502  
2501 2503  
... ... @@ -2500,17 +2502,19 @@
2500 2502 int res = 0;
2501 2503  
2502 2504 if (req->memory != V4L2_MEMORY_MMAP) {
2503   - dprintk(1,
  2505 + dprintk(2,
2504 2506 KERN_ERR
2505 2507 "%s: only MEMORY_MMAP capture is supported, not %d\n",
2506 2508 ZR_DEVNAME(zr), req->memory);
2507 2509 return -EINVAL;
2508 2510 }
2509 2511  
2510   - mutex_lock(&zr->resource_lock);
  2512 + if (req->count == 0)
  2513 + return zoran_streamoff(file, fh, req->type);
2511 2514  
  2515 + mutex_lock(&zr->resource_lock);
2512 2516 if (fh->v4l_buffers.allocated || fh->jpg_buffers.allocated) {
2513   - dprintk(1,
  2517 + dprintk(2,
2514 2518 KERN_ERR
2515 2519 "%s: VIDIOC_REQBUFS - buffers already allocated\n",
2516 2520 ZR_DEVNAME(zr));