Merge branch 'fix/asoc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[pandora-kernel.git] / drivers / media / common / saa7146_video.c
index 0ac5c61..9aafa4e 100644 (file)
@@ -553,8 +553,6 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
                }
        }
 
-       mutex_lock(&dev->lock);
-
        /* ok, accept it */
        vv->ov_fb = *fb;
        vv->ov_fmt = fmt;
@@ -563,8 +561,6 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
                vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8;
                DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline));
        }
-
-       mutex_unlock(&dev->lock);
        return 0;
 }
 
@@ -649,8 +645,6 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c)
                return -EINVAL;
        }
 
-       mutex_lock(&dev->lock);
-
        switch (ctrl->type) {
        case V4L2_CTRL_TYPE_BOOLEAN:
        case V4L2_CTRL_TYPE_MENU:
@@ -693,7 +687,6 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c)
                /* fixme: we can support changing VFLIP and HFLIP here... */
                if (IS_CAPTURE_ACTIVE(fh) != 0) {
                        DEB_D(("V4L2_CID_HFLIP while active capture.\n"));
-                       mutex_unlock(&dev->lock);
                        return -EBUSY;
                }
                vv->hflip = c->value;
@@ -701,16 +694,13 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c)
        case V4L2_CID_VFLIP:
                if (IS_CAPTURE_ACTIVE(fh) != 0) {
                        DEB_D(("V4L2_CID_VFLIP while active capture.\n"));
-                       mutex_unlock(&dev->lock);
                        return -EBUSY;
                }
                vv->vflip = c->value;
                break;
        default:
-               mutex_unlock(&dev->lock);
                return -EINVAL;
        }
-       mutex_unlock(&dev->lock);
 
        if (IS_OVERLAY_ACTIVE(fh) != 0) {
                saa7146_stop_preview(fh);
@@ -902,22 +892,18 @@ static int vidioc_s_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_f
        err = vidioc_try_fmt_vid_overlay(file, fh, f);
        if (0 != err)
                return err;
-       mutex_lock(&dev->lock);
        fh->ov.win    = f->fmt.win;
        fh->ov.nclips = f->fmt.win.clipcount;
        if (fh->ov.nclips > 16)
                fh->ov.nclips = 16;
        if (copy_from_user(fh->ov.clips, f->fmt.win.clips,
                                sizeof(struct v4l2_clip) * fh->ov.nclips)) {
-               mutex_unlock(&dev->lock);
                return -EFAULT;
        }
 
        /* fh->ov.fh is used to indicate that we have valid overlay informations, too */
        fh->ov.fh = fh;
 
-       mutex_unlock(&dev->lock);
-
        /* check if our current overlay is active */
        if (IS_OVERLAY_ACTIVE(fh) != 0) {
                saa7146_stop_preview(fh);
@@ -976,8 +962,6 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id)
                }
        }
 
-       mutex_lock(&dev->lock);
-
        for (i = 0; i < dev->ext_vv_data->num_stds; i++)
                if (*id & dev->ext_vv_data->stds[i].id)
                        break;
@@ -988,8 +972,6 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id)
                found = 1;
        }
 
-       mutex_unlock(&dev->lock);
-
        if (vv->ov_suspend != NULL) {
                saa7146_start_preview(vv->ov_suspend);
                vv->ov_suspend = NULL;
@@ -1354,7 +1336,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
                            sizeof(struct saa7146_buf),
-                           file, NULL);
+                           file, &dev->v4l2_lock);
 
        return 0;
 }