diff options
author | Lad, Prabhakar <prabhakar.csengg@gmail.com> | 2014-05-16 10:33:40 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-05-23 19:23:47 -0300 |
commit | d26d26b522e4d2647771c66a737af0deb64ef202 (patch) | |
tree | 17d04871d22604bf9fbf14f999a7b607c775cb8b /drivers/media/platform/davinci/vpif_capture.c | |
parent | 41b9f24e4df995aebfde63e42d5cec1a82e9a9c7 (diff) | |
download | linux-d26d26b522e4d2647771c66a737af0deb64ef202.tar.gz linux-d26d26b522e4d2647771c66a737af0deb64ef202.tar.bz2 linux-d26d26b522e4d2647771c66a737af0deb64ef202.zip |
[media] media: davinci: vpif_capture: use vb2_fop_mmap/poll
No need to reinvent the wheel. Just use the already existing
functions for that.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform/davinci/vpif_capture.c')
-rw-r--r-- | drivers/media/platform/davinci/vpif_capture.c | 53 |
1 files changed, 6 insertions, 47 deletions
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 58dddf698679..a50e3927ab65 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -751,50 +751,6 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode) } /** - * vpif_mmap : It is used to map kernel space buffers into user spaces - * @filep: file pointer - * @vma: ptr to vm_area_struct - */ -static int vpif_mmap(struct file *filep, struct vm_area_struct *vma) -{ - /* Get the channel object and file handle object */ - struct vpif_fh *fh = filep->private_data; - struct channel_obj *ch = fh->channel; - struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]); - int ret; - - vpif_dbg(2, debug, "vpif_mmap\n"); - - if (mutex_lock_interruptible(&common->lock)) - return -ERESTARTSYS; - ret = vb2_mmap(&common->buffer_queue, vma); - mutex_unlock(&common->lock); - return ret; -} - -/** - * vpif_poll: It is used for select/poll system call - * @filep: file pointer - * @wait: poll table to wait - */ -static unsigned int vpif_poll(struct file *filep, poll_table * wait) -{ - struct vpif_fh *fh = filep->private_data; - struct channel_obj *channel = fh->channel; - struct common_obj *common = &(channel->common[VPIF_VIDEO_INDEX]); - unsigned int res = 0; - - vpif_dbg(2, debug, "vpif_poll\n"); - - if (common->started) { - mutex_lock(&common->lock); - res = vb2_poll(&common->buffer_queue, filep, wait); - mutex_unlock(&common->lock); - } - return res; -} - -/** * vpif_open : vpif open handler * @filep: file ptr * @@ -1797,8 +1753,8 @@ static struct v4l2_file_operations vpif_fops = { .open = vpif_open, .release = vpif_release, .unlocked_ioctl = video_ioctl2, - .mmap = vpif_mmap, - .poll = vpif_poll + .mmap = vb2_fop_mmap, + .poll = vb2_fop_poll }; /* vpif video template */ @@ -1884,6 +1840,7 @@ static int vpif_async_bound(struct v4l2_async_notifier *notifier, static int vpif_probe_complete(void) { struct common_obj *common; + struct video_device *vdev; struct channel_obj *ch; struct vb2_queue *q; int i, j, err, k; @@ -1931,7 +1888,9 @@ static int vpif_probe_complete(void) INIT_LIST_HEAD(&common->dma_queue); - err = video_register_device(ch->video_dev, + vdev = ch->video_dev; + vdev->queue = q; + err = video_register_device(vdev, VFL_TYPE_GRABBER, (j ? 1 : 0)); if (err) goto probe_out; |