diff options
author | Hans de Goede <hdegoede@redhat.com> | 2010-12-31 05:41:54 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-01-19 08:44:59 -0500 |
commit | ce5610bca74571674c1970d33063e7c06295a9a4 (patch) | |
tree | 18d3c2db4f357767e8d189e68e8089b524d7230b /drivers/media/video/gspca/gspca.c | |
parent | ee3629914b2b115f00f4197e80b1e7cb12881059 (diff) |
[media] gspca_main: Allow switching from read to mmap / userptr mode
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>
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r-- | drivers/media/video/gspca/gspca.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 244fb76eaead..4ab906be8962 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -1497,6 +1497,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1497 | return -ERESTARTSYS; | 1497 | return -ERESTARTSYS; |
1498 | 1498 | ||
1499 | if (gspca_dev->memory != GSPCA_MEMORY_NO | 1499 | if (gspca_dev->memory != GSPCA_MEMORY_NO |
1500 | && gspca_dev->memory != GSPCA_MEMORY_READ | ||
1500 | && gspca_dev->memory != rb->memory) { | 1501 | && gspca_dev->memory != rb->memory) { |
1501 | ret = -EBUSY; | 1502 | ret = -EBUSY; |
1502 | goto out; | 1503 | goto out; |
@@ -1525,6 +1526,9 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1525 | gspca_stream_off(gspca_dev); | 1526 | gspca_stream_off(gspca_dev); |
1526 | mutex_unlock(&gspca_dev->usb_lock); | 1527 | mutex_unlock(&gspca_dev->usb_lock); |
1527 | } | 1528 | } |
1529 | /* Don't restart the stream when switching from read to mmap mode */ | ||
1530 | if (gspca_dev->memory == GSPCA_MEMORY_READ) | ||
1531 | streaming = 0; | ||
1528 | 1532 | ||
1529 | /* free the previous allocated buffers, if any */ | 1533 | /* free the previous allocated buffers, if any */ |
1530 | if (gspca_dev->nframes != 0) | 1534 | if (gspca_dev->nframes != 0) |