Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753291AbaLTKvS (ORCPT ); Sat, 20 Dec 2014 05:51:18 -0500 Received: from mail-pd0-f170.google.com ([209.85.192.170]:58016 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752911AbaLTKs2 (ORCPT ); Sat, 20 Dec 2014 05:48:28 -0500 From: "Lad, Prabhakar" To: LMML , Scott Jiang Cc: LKML , adi-buildroot-devel@lists.sourceforge.net, Mauro Carvalho Chehab , "Lad, Prabhakar" Subject: [PATCH 06/15] media: blackfin: bfin_capture: use vb2_fop_mmap/poll Date: Sat, 20 Dec 2014 16:17:33 +0530 Message-Id: <1419072462-3168-7-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1419072462-3168-1-git-send-email-prabhakar.csengg@gmail.com> References: <1419072462-3168-1-git-send-email-prabhakar.csengg@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No need to reinvent the wheel. Just use the already existing functions provided by vb2. Signed-off-by: Lad, Prabhakar --- 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 76d42bb..df4a6b4 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, } #endif -static unsigned int bcap_poll(struct file *file, poll_table *wait) -{ - struct bcap_device *bcap_dev = video_drvdata(file); - unsigned int res; - - mutex_lock(&bcap_dev->mutex); - res = vb2_poll(&bcap_dev->buffer_queue, file, wait); - mutex_unlock(&bcap_dev->mutex); - return res; -} - static int bcap_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, unsigned int *nbuffers, unsigned int *nplanes, @@ -896,11 +873,11 @@ static struct v4l2_file_operations bcap_fops = { .open = bcap_open, .release = bcap_release, .unlocked_ioctl = video_ioctl2, - .mmap = bcap_mmap, + .mmap = vb2_fop_mmap, #ifndef CONFIG_MMU .get_unmapped_area = bcap_get_unmapped_area, #endif - .poll = bcap_poll + .poll = vb2_fop_poll }; static int bcap_probe(struct platform_device *pdev) @@ -997,6 +974,7 @@ static int bcap_probe(struct platform_device *pdev) INIT_LIST_HEAD(&bcap_dev->dma_queue); vfd->lock = &bcap_dev->mutex; + vfd->queue = q; /* register video device */ ret = video_register_device(bcap_dev->video_dev, VFL_TYPE_GRABBER, -1); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/