The patch number 9911 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: vidioc_try_fmt_vid_cap() doesn't need any lock


vidioc_try_fmt_vid_cap() just checks if a given resolution is supported.
It doesn't touch on struct em28xx device descriptor. so, there's no need
to lock.

While there, use unlikely() for those values that aren't likely to
occur.

Priority: normal

Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com>


---

 linux/drivers/media/video/em28xx/em28xx-video.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff -r 8fd1a805bf23 -r 3980938ba091 
linux/drivers/media/video/em28xx/em28xx-video.c
--- a/linux/drivers/media/video/em28xx/em28xx-video.c   Tue Dec 16 21:19:24 
2008 -0200
+++ b/linux/drivers/media/video/em28xx/em28xx-video.c   Tue Dec 16 21:36:13 
2008 -0200
@@ -735,18 +735,16 @@ static int vidioc_try_fmt_vid_cap(struct
        /* width must even because of the YUYV format
           height must be even because of interlacing */
        height &= 0xfffe;
-       width &= 0xfffe;
-
-       if (height < 32)
+       width  &= 0xfffe;
+
+       if (unlikely(height < 32))
                height = 32;
-       if (height > maxh)
+       if (unlikely(height > maxh))
                height = maxh;
-       if (width < 48)
+       if (unlikely(width < 48))
                width = 48;
-       if (width > maxw)
+       if (unlikely(width > maxw))
                width = maxw;
-
-       mutex_lock(&dev->lock);
 
        if (dev->board.is_em2800) {
                /* the em2800 can only scale down to 50% */
@@ -777,7 +775,6 @@ static int vidioc_try_fmt_vid_cap(struct
        f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
        f->fmt.pix.field = V4L2_FIELD_INTERLACED;
 
-       mutex_unlock(&dev->lock);
        return 0;
 }
 


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/3980938ba09179cc89f3cba0a36470fbbbf11484

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to