Skip to content

Commit

Permalink
V4L/DVB (10713): zoran: if reqbufs is called with count == 0, do a st…
Browse files Browse the repository at this point in the history
…reamoff.

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>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent 5ca75b0 commit 84c1b09
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/media/video/zoran/zoran_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2493,24 +2493,28 @@ static int zoran_overlay(struct file *file, void *__fh, unsigned int on)
return res;
}

static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type type);

static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffers *req)
{
struct zoran_fh *fh = __fh;
struct zoran *zr = fh->zr;
int res = 0;

if (req->memory != V4L2_MEMORY_MMAP) {
dprintk(1,
dprintk(2,
KERN_ERR
"%s: only MEMORY_MMAP capture is supported, not %d\n",
ZR_DEVNAME(zr), req->memory);
return -EINVAL;
}

mutex_lock(&zr->resource_lock);
if (req->count == 0)
return zoran_streamoff(file, fh, req->type);

mutex_lock(&zr->resource_lock);
if (fh->v4l_buffers.allocated || fh->jpg_buffers.allocated) {
dprintk(1,
dprintk(2,
KERN_ERR
"%s: VIDIOC_REQBUFS - buffers already allocated\n",
ZR_DEVNAME(zr));
Expand Down

0 comments on commit 84c1b09

Please sign in to comment.