From patchwork Fri May 16 13:33:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 4193081 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E3E57BFF02 for ; Fri, 16 May 2014 13:55:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 07B7D20295 for ; Fri, 16 May 2014 13:55:56 +0000 (UTC) Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0CB7F20270 for ; Fri, 16 May 2014 13:55:54 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDsqgt029232; Fri, 16 May 2014 08:54:52 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDsne7025313; Fri, 16 May 2014 08:54:52 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 16 May 2014 08:54:50 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDsoct011914; Fri, 16 May 2014 08:54:50 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 05E7080627; Fri, 16 May 2014 08:54:50 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dlelxv84.itg.ti.com (dlelxv84.itg.ti.com [172.17.0.246]) by linux.omap.com (Postfix) with ESMTP id 3E27480633 for ; Fri, 16 May 2014 08:41:56 -0500 (CDT) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dlelxv84.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDfu02011779 for ; Fri, 16 May 2014 08:41:56 -0500 Received: from mail6.bemta12.messagelabs.com (mail6.bemta12.messagelabs.com [216.82.250.247]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDftas002158 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 May 2014 08:41:55 -0500 Received: from [216.82.250.51:61878] by server-15.bemta-12.messagelabs.com id 3B/C5-19062-3A516735; Fri, 16 May 2014 13:41:55 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-5.tower-108.messagelabs.com!1400247713!3461549!1 X-Originating-IP: [209.85.160.48] X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30577 invoked from network); 16 May 2014 13:41:54 -0000 Received: from mail-pb0-f48.google.com (HELO mail-pb0-f48.google.com) (209.85.160.48) by server-5.tower-108.messagelabs.com with RC4-SHA encrypted SMTP; 16 May 2014 13:41:54 -0000 Received: by mail-pb0-f48.google.com with SMTP id rr13so2606184pbb.7 for ; Fri, 16 May 2014 06:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eoDs3iVXjVxyNH3zVV3oEtCDsoBdLqBB/cREhW9Q6Ew=; b=LTOZZulSQPW/NG1cuUgxFzaZwuZrRYYAkXZQ1oG9v24Y/xjVhCkjTV8uiKShDCsKJe WixwJzZJuQ5G5H8ecCXBqGMEyZ5tUBj1pcu/OSzpgwrYPYIsjcyuLBKXu4KQLMs6oF6s 9xMnEQxBxP8qq3I0zT2YcxMbOBE1EPsYLR16m8KPDYz1ETcT1/fX3hc2r9xySJ3q052f O21vGrk96o0yWf3W4DlbjXMeSx2zunfkMUKgzWM6ecySqmM76OUJiiDZRENQMMaj0SDu wkOPWECe9c1NXuia1GfbSti8cwIQ6KiqR3f4bnGzkfpneJvtBulQEEW6FVsDBIE+QE/T frmw== X-Received: by 10.68.164.67 with SMTP id yo3mr21226926pbb.104.1400247713403; Fri, 16 May 2014 06:41:53 -0700 (PDT) Received: from localhost.localdomain ([27.107.45.22]) by mx.google.com with ESMTPSA id cj1sm34699547pac.40.2014.05.16.06.41.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 06:41:52 -0700 (PDT) From: "Lad, Prabhakar" To: LMML , Hans Verkuil Subject: [PATCH v5 34/49] media: davinci: vpif_capture: use vb2_fop_mmap/poll Date: Fri, 16 May 2014 19:03:40 +0530 Message-ID: <1400247235-31434-37-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400247235-31434-1-git-send-email-prabhakar.csengg@gmail.com> References: <1400247235-31434-1-git-send-email-prabhakar.csengg@gmail.com> CC: DLOS , LKML X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Lad, Prabhakar" Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpif_capture.c | 53 +++---------------------- 1 file changed, 6 insertions(+), 47 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 58dddf6..a50e392 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;