Skip to content

Commit

Permalink
[media] gspca_main: Allow switching from read to mmap / userptr mode
Browse files Browse the repository at this point in the history
Some applications (xawtv, qv4l2) mix read and mmap calls. Allow switching
from read mode back to mmap mode (by doing a reqbufs).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans de Goede authored and Mauro Carvalho Chehab committed Jan 19, 2011
1 parent ee36299 commit ce5610b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/media/video/gspca/gspca.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
return -ERESTARTSYS;

if (gspca_dev->memory != GSPCA_MEMORY_NO
&& gspca_dev->memory != GSPCA_MEMORY_READ
&& gspca_dev->memory != rb->memory) {
ret = -EBUSY;
goto out;
Expand Down Expand Up @@ -1525,6 +1526,9 @@ static int vidioc_reqbufs(struct file *file, void *priv,
gspca_stream_off(gspca_dev);
mutex_unlock(&gspca_dev->usb_lock);
}
/* Don't restart the stream when switching from read to mmap mode */
if (gspca_dev->memory == GSPCA_MEMORY_READ)
streaming = 0;

/* free the previous allocated buffers, if any */
if (gspca_dev->nframes != 0)
Expand Down

0 comments on commit ce5610b

Please sign in to comment.