The patch number 9910 was added via Mauro Carvalho Chehab <mche...@redhat.com> to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward compatible with older kernels. Compatibility modifications will be removed before inclusion into the mainstream Kernel If anyone has any objections, please let us know by sending a message to: v4l-dvb-maintai...@linuxtv.org ------ From: Mauro Carvalho Chehab <mche...@redhat.com> em28xx: move res_get locks to the caller routines Priority: normal Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com> --- linux/drivers/media/video/em28xx/em28xx-video.c | 38 ++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff -r 40b02ddf9efc -r 8fd1a805bf23 linux/drivers/media/video/em28xx/em28xx-video.c --- a/linux/drivers/media/video/em28xx/em28xx-video.c Tue Dec 16 21:00:49 2008 -0200 +++ b/linux/drivers/media/video/em28xx/em28xx-video.c Tue Dec 16 21:19:24 2008 -0200 @@ -604,12 +604,10 @@ static int res_get(struct em28xx_fh *fh) return rc; if (dev->stream_on) - return -EINVAL; - - mutex_lock(&dev->lock); + return -EBUSY; + dev->stream_on = 1; fh->stream_on = 1; - mutex_unlock(&dev->lock); return rc; } @@ -1268,8 +1266,12 @@ static int vidioc_streamon(struct file * return rc; - if (unlikely(res_get(fh) < 0)) - return -EBUSY; + mutex_lock(&dev->lock); + rc = res_get(fh); + mutex_unlock(&dev->lock); + + if (unlikely(rc < 0)) + return rc; return (videobuf_streamon(&fh->vb_vidq)); } @@ -1801,8 +1803,12 @@ em28xx_v4l2_read(struct file *filp, char */ if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { - if (unlikely(res_get(fh))) - return -EBUSY; + mutex_lock(&dev->lock); + rc = res_get(fh); + mutex_unlock(&dev->lock); + + if (unlikely(rc < 0)) + return rc; return videobuf_read_stream(&fh->vb_vidq, buf, count, pos, 0, filp->f_flags & O_NONBLOCK); @@ -1824,7 +1830,11 @@ static unsigned int em28xx_v4l2_poll(str if (rc < 0) return rc; - if (unlikely(res_get(fh) < 0)) + mutex_lock(&dev->lock); + rc = res_get(fh); + mutex_unlock(&dev->lock); + + if (unlikely(rc < 0)) return POLLERR; if (V4L2_BUF_TYPE_VIDEO_CAPTURE != fh->type) @@ -1842,11 +1852,15 @@ static int em28xx_v4l2_mmap(struct file struct em28xx *dev = fh->dev; int rc; - if (unlikely(res_get(fh) < 0)) - return -EBUSY; - rc = check_dev(dev); if (rc < 0) + return rc; + + mutex_lock(&dev->lock); + rc = res_get(fh); + mutex_unlock(&dev->lock); + + if (unlikely(rc < 0)) return rc; rc = videobuf_mmap_mapper(&fh->vb_vidq, vma); --- Patch is available at: http://linuxtv.org/hg/v4l-dvb/rev/8fd1a805bf23761dfcaea6d510bc4e201548aae7 _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits