aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/saa7146_video.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-21 19:50:31 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-21 19:50:31 -0500
commit13a3cec8443290b082af2a5254562aca247fe591 (patch)
tree5c873a2c9333be348266234ac5d7101caa1b6d7d /drivers/media/common/saa7146_video.c
parent973c9f4f49ca96a53bcf6384c4c59ccd26c33906 (diff)
parent88914bdf8c677ebd7e797adac05e47303fd6ac77 (diff)
Merge branch 'media_fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'media_fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (101 commits) [media] staging/lirc: fix mem leaks and ptr err usage [media] hdpvr: reduce latency of i2c read/write w/recycled buffer [media] hdpvr: enable IR part [media] rc/mceusb: timeout should be in ns, not us [media] v4l2-device: fix 'use-after-freed' oops [media] v4l2-dev: don't memset video_device.dev [media] zoran: use video_device_alloc instead of kmalloc [media] w9966: zero device state after a detach [media] v4l: Fix a use-before-set in the control framework [media] v4l: Include linux/videodev2.h in media/v4l2-ctrls.h [media] DocBook/v4l: update V4L2 revision and update copyright years [media] DocBook/v4l: fix validation error in dev-rds.xml [media] v4l2-ctrls: queryctrl shouldn't attempt to replace V4L2_CID_PRIVATE_BASE IDs [media] v4l2-ctrls: fix missing 'read-only' check [media] pvrusb2: Provide more information about IR units to lirc_zilog and ir-kbd-i2c [media] ir-kbd-i2c: Add back defaults setting for Zilog Z8's at addr 0x71 [media] lirc_zilog: Update TODO.lirc_zilog [media] lirc_zilog: Add Andy Walls to copyright notice and authors list [media] lirc_zilog: Remove useless struct i2c_driver.command function [media] lirc_zilog: Remove unneeded tests for existence of the IR Tx function ...
Diffstat (limited to 'drivers/media/common/saa7146_video.c')
-rw-r--r--drivers/media/common/saa7146_video.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index 0ac5c619aec..9aafa4e969a 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -553,8 +553,6 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
553 } 553 }
554 } 554 }
555 555
556 mutex_lock(&dev->lock);
557
558 /* ok, accept it */ 556 /* ok, accept it */
559 vv->ov_fb = *fb; 557 vv->ov_fb = *fb;
560 vv->ov_fmt = fmt; 558 vv->ov_fmt = fmt;
@@ -563,8 +561,6 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
563 vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8; 561 vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8;
564 DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline)); 562 DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline));
565 } 563 }
566
567 mutex_unlock(&dev->lock);
568 return 0; 564 return 0;
569} 565}
570 566
@@ -649,8 +645,6 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c)
649 return -EINVAL; 645 return -EINVAL;
650 } 646 }
651 647
652 mutex_lock(&dev->lock);
653
654 switch (ctrl->type) { 648 switch (ctrl->type) {
655 case V4L2_CTRL_TYPE_BOOLEAN: 649 case V4L2_CTRL_TYPE_BOOLEAN:
656 case V4L2_CTRL_TYPE_MENU: 650 case V4L2_CTRL_TYPE_MENU:
@@ -693,7 +687,6 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c)
693 /* fixme: we can support changing VFLIP and HFLIP here... */ 687 /* fixme: we can support changing VFLIP and HFLIP here... */
694 if (IS_CAPTURE_ACTIVE(fh) != 0) { 688 if (IS_CAPTURE_ACTIVE(fh) != 0) {
695 DEB_D(("V4L2_CID_HFLIP while active capture.\n")); 689 DEB_D(("V4L2_CID_HFLIP while active capture.\n"));
696 mutex_unlock(&dev->lock);
697 return -EBUSY; 690 return -EBUSY;
698 } 691 }
699 vv->hflip = c->value; 692 vv->hflip = c->value;
@@ -701,16 +694,13 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c)
701 case V4L2_CID_VFLIP: 694 case V4L2_CID_VFLIP:
702 if (IS_CAPTURE_ACTIVE(fh) != 0) { 695 if (IS_CAPTURE_ACTIVE(fh) != 0) {
703 DEB_D(("V4L2_CID_VFLIP while active capture.\n")); 696 DEB_D(("V4L2_CID_VFLIP while active capture.\n"));
704 mutex_unlock(&dev->lock);
705 return -EBUSY; 697 return -EBUSY;
706 } 698 }
707 vv->vflip = c->value; 699 vv->vflip = c->value;
708 break; 700 break;
709 default: 701 default:
710 mutex_unlock(&dev->lock);
711 return -EINVAL; 702 return -EINVAL;
712 } 703 }
713 mutex_unlock(&dev->lock);
714 704
715 if (IS_OVERLAY_ACTIVE(fh) != 0) { 705 if (IS_OVERLAY_ACTIVE(fh) != 0) {
716 saa7146_stop_preview(fh); 706 saa7146_stop_preview(fh);
@@ -902,22 +892,18 @@ static int vidioc_s_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_f
902 err = vidioc_try_fmt_vid_overlay(file, fh, f); 892 err = vidioc_try_fmt_vid_overlay(file, fh, f);
903 if (0 != err) 893 if (0 != err)
904 return err; 894 return err;
905 mutex_lock(&dev->lock);
906 fh->ov.win = f->fmt.win; 895 fh->ov.win = f->fmt.win;
907 fh->ov.nclips = f->fmt.win.clipcount; 896 fh->ov.nclips = f->fmt.win.clipcount;
908 if (fh->ov.nclips > 16) 897 if (fh->ov.nclips > 16)
909 fh->ov.nclips = 16; 898 fh->ov.nclips = 16;
910 if (copy_from_user(fh->ov.clips, f->fmt.win.clips, 899 if (copy_from_user(fh->ov.clips, f->fmt.win.clips,
911 sizeof(struct v4l2_clip) * fh->ov.nclips)) { 900 sizeof(struct v4l2_clip) * fh->ov.nclips)) {
912 mutex_unlock(&dev->lock);
913 return -EFAULT; 901 return -EFAULT;
914 } 902 }
915 903
916 /* fh->ov.fh is used to indicate that we have valid overlay informations, too */ 904 /* fh->ov.fh is used to indicate that we have valid overlay informations, too */
917 fh->ov.fh = fh; 905 fh->ov.fh = fh;
918 906
919 mutex_unlock(&dev->lock);
920
921 /* check if our current overlay is active */ 907 /* check if our current overlay is active */
922 if (IS_OVERLAY_ACTIVE(fh) != 0) { 908 if (IS_OVERLAY_ACTIVE(fh) != 0) {
923 saa7146_stop_preview(fh); 909 saa7146_stop_preview(fh);
@@ -976,8 +962,6 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id)
976 } 962 }
977 } 963 }
978 964
979 mutex_lock(&dev->lock);
980
981 for (i = 0; i < dev->ext_vv_data->num_stds; i++) 965 for (i = 0; i < dev->ext_vv_data->num_stds; i++)
982 if (*id & dev->ext_vv_data->stds[i].id) 966 if (*id & dev->ext_vv_data->stds[i].id)
983 break; 967 break;
@@ -988,8 +972,6 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id)
988 found = 1; 972 found = 1;
989 } 973 }
990 974
991 mutex_unlock(&dev->lock);
992
993 if (vv->ov_suspend != NULL) { 975 if (vv->ov_suspend != NULL) {
994 saa7146_start_preview(vv->ov_suspend); 976 saa7146_start_preview(vv->ov_suspend);
995 vv->ov_suspend = NULL; 977 vv->ov_suspend = NULL;
@@ -1354,7 +1336,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
1354 V4L2_BUF_TYPE_VIDEO_CAPTURE, 1336 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1355 V4L2_FIELD_INTERLACED, 1337 V4L2_FIELD_INTERLACED,
1356 sizeof(struct saa7146_buf), 1338 sizeof(struct saa7146_buf),
1357 file, NULL); 1339 file, &dev->v4l2_lock);
1358 1340
1359 return 0; 1341 return 0;
1360} 1342}