Re: [PATCH v3 06/15] media: blackfin: bfin_capture: use vb2_fop_mmap/poll

Hans Verkuil
2015-03-03T10:14:50Z

On 02/21/2015 07:39 PM, Lad Prabhakar wrote:
> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>
> No need to reinvent the wheel. Just use the already existing
> functions provided by vb2.
>
> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> ---
> drivers/media/platform/blackfin/bfin_capture.c | 28 +++-----------------------
> 1 file changed, 3 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
> index be0d0a2b..ee0e848 100644
> --- a/drivers/media/platform/blackfin/bfin_capture.c
> +++ b/drivers/media/platform/blackfin/bfin_capture.c
> @@ -244,18 +244,6 @@ static int bcap_release(struct file *file)
> return 0;
> }
>
> -static int bcap_mmap(struct file *file, struct vm_area_struct *vma)
> -{
> - struct bcap_device *bcap_dev = video_drvdata(file);
> - int ret;
> -
> - if (mutex_lock_interruptible(&bcap_dev->mutex))
> - return -ERESTARTSYS;
> - ret = vb2_mmap(&bcap_dev->buffer_queue, vma);
> - mutex_unlock(&bcap_dev->mutex);
> - return ret;
> -}
> -
> #ifndef CONFIG_MMU
> static unsigned long bcap_get_unmapped_area(struct file *file,
> unsigned long addr,
> @@ -273,17 +261,6 @@ static unsigned long bcap_get_unmapped_area(struct file *file,

This can also be replaced by vb2_fop_get_unmapped_area().

Patch is welcome :-)

Regards,

Hans