X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmedia%2Fcommon%2Fsaa7146_video.c;h=7e0cedc557df2a17e8ed8b38114c27c75e321332;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=7ebac7949df3789aa165ba472a26d6fc319a9651;hpb=76828883507a47dae78837ab5dec5a5b4513c667;p=linux-2.6.git diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 7ebac7949..7e0cedc55 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c @@ -318,6 +318,7 @@ int saa7146_start_preview(struct saa7146_fh *fh) return 0; } +EXPORT_SYMBOL_GPL(saa7146_start_preview); int saa7146_stop_preview(struct saa7146_fh *fh) { @@ -352,6 +353,7 @@ int saa7146_stop_preview(struct saa7146_fh *fh) return 0; } +EXPORT_SYMBOL_GPL(saa7146_stop_preview); static int s_fmt(struct saa7146_fh *fh, struct v4l2_format *f) { @@ -378,20 +380,20 @@ static int s_fmt(struct saa7146_fh *fh, struct v4l2_format *f) err = try_win(dev,&f->fmt.win); if (0 != err) return err; - down(&dev->lock); + 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)) { - up(&dev->lock); + mutex_unlock(&dev->lock); return -EFAULT; } /* fh->ov.fh is used to indicate that we have valid overlay informations, too */ fh->ov.fh = fh; - up(&dev->lock); + mutex_unlock(&dev->lock); /* check if our current overlay is active */ if (IS_OVERLAY_ACTIVE(fh) != 0) { @@ -516,7 +518,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c) return -EINVAL; } - down(&dev->lock); + mutex_lock(&dev->lock); switch (ctrl->type) { case V4L2_CTRL_TYPE_BOOLEAN: @@ -560,7 +562,7 @@ static int set_control(struct saa7146_fh *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")); - up(&dev->lock); + mutex_unlock(&dev->lock); return -EINVAL; } vv->hflip = c->value; @@ -568,7 +570,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c) case V4L2_CID_VFLIP: if (IS_CAPTURE_ACTIVE(fh) != 0) { DEB_D(("V4L2_CID_VFLIP while active capture.\n")); - up(&dev->lock); + mutex_unlock(&dev->lock); return -EINVAL; } vv->vflip = c->value; @@ -577,7 +579,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c) return -EINVAL; } } - up(&dev->lock); + mutex_unlock(&dev->lock); if (IS_OVERLAY_ACTIVE(fh) != 0) { saa7146_stop_preview(fh); @@ -939,7 +941,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int } } - down(&dev->lock); + mutex_lock(&dev->lock); /* ok, accept it */ vv->ov_fb = *fb; @@ -948,7 +950,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width*fmt->depth/8; - up(&dev->lock); + mutex_unlock(&dev->lock); return 0; } @@ -1086,7 +1088,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int } } - down(&dev->lock); + mutex_lock(&dev->lock); for(i = 0; i < dev->ext_vv_data->num_stds; i++) if (*id & dev->ext_vv_data->stds[i].id) @@ -1098,7 +1100,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int found = 1; } - up(&dev->lock); + mutex_unlock(&dev->lock); if (vv->ov_suspend != NULL) { saa7146_start_preview(vv->ov_suspend); @@ -1188,6 +1190,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int } return err; } +#ifdef CONFIG_VIDEO_V4L1_COMPAT case VIDIOCGMBUF: { struct video_mbuf *mbuf = arg; @@ -1201,11 +1204,11 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int DEB_D(("VIDIOCGMBUF \n")); q = &fh->video_q; - down(&q->lock); + mutex_lock(&q->lock); err = videobuf_mmap_setup(q,gbuffers,gbufsize, V4L2_MEMORY_MMAP); if (err < 0) { - up(&q->lock); + mutex_unlock(&q->lock); return err; } memset(mbuf,0,sizeof(*mbuf)); @@ -1213,9 +1216,10 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int mbuf->size = gbuffers * gbufsize; for (i = 0; i < gbuffers; i++) mbuf->offsets[i] = i * gbufsize; - up(&q->lock); + mutex_unlock(&q->lock); return 0; } +#endif default: return v4l_compat_translate_ioctl(inode,file,cmd,arg, saa7146_video_do_ioctl); @@ -1275,7 +1279,7 @@ static int buffer_prepare(struct videobuf_queue *q, buf->vb.field != field || buf->vb.field != fh->video_fmt.field || buf->fmt != &fh->video_fmt) { - saa7146_dma_free(dev,buf); + saa7146_dma_free(dev,q,buf); } if (STATE_NEEDS_INIT == buf->vb.state) { @@ -1304,7 +1308,7 @@ static int buffer_prepare(struct videobuf_queue *q, saa7146_pgtable_alloc(dev->pci, &buf->pt[0]); } - err = videobuf_iolock(dev->pci,&buf->vb, &vv->ov_fb); + err = videobuf_iolock(q,&buf->vb, &vv->ov_fb); if (err) goto oops; err = saa7146_pgtable_build(dev,buf); @@ -1318,7 +1322,7 @@ static int buffer_prepare(struct videobuf_queue *q, oops: DEB_D(("error out.\n")); - saa7146_dma_free(dev,buf); + saa7146_dma_free(dev,q,buf); return err; } @@ -1363,7 +1367,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) struct saa7146_buf *buf = (struct saa7146_buf *)vb; DEB_CAP(("vbuf:%p\n",vb)); - saa7146_dma_free(dev,buf); + saa7146_dma_free(dev,q,buf); } static struct videobuf_queue_ops video_qops = { @@ -1414,7 +1418,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file) sizeof(struct saa7146_buf), file); - init_MUTEX(&fh->video_q.lock); + mutex_init(&fh->video_q.lock); return 0; }