From patchwork Sun Oct 12 20:40:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 5071881 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5E1229F3ED for ; Sun, 12 Oct 2014 20:43:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8278F20176 for ; Sun, 12 Oct 2014 20:43:57 +0000 (UTC) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEDD220179 for ; Sun, 12 Oct 2014 20:43:55 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9CKgvmB015558; Sun, 12 Oct 2014 15:42:57 -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 s9CKgsrk014497; Sun, 12 Oct 2014 15:42:57 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Sun, 12 Oct 2014 15:42:55 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9CKgsVA019626; Sun, 12 Oct 2014 15:42:54 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id B49B580627; Sun, 12 Oct 2014 15:42:54 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflxv17.itg.ti.com (dflxv17.itg.ti.com [128.247.5.93]) by linux.omap.com (Postfix) with ESMTP id 40FF28062A for ; Sun, 12 Oct 2014 15:41:02 -0500 (CDT) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflxv17.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9CKf2kc029816 for ; Sun, 12 Oct 2014 15:41:02 -0500 Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9CKf1hJ009331 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 12 Oct 2014 15:41:02 -0500 Received: from [216.82.242.131:41386] by server-7.bemta-8.messagelabs.com id 89/45-03760-D57EA345; Sun, 12 Oct 2014 20:41:01 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-2.tower-76.messagelabs.com!1413146459!38360900!1 X-Originating-IP: [209.85.212.169] X-SpamReason: No, hits=0.2 required=7.0 tests=RCVD_ILLEGAL_IP X-StarScan-Received: X-StarScan-Version: 6.12.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2116 invoked from network); 12 Oct 2014 20:41:00 -0000 Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by server-2.tower-76.messagelabs.com with RC4-SHA encrypted SMTP; 12 Oct 2014 20:41:00 -0000 Received: by mail-wi0-f169.google.com with SMTP id h11so1890557wiw.4 for ; Sun, 12 Oct 2014 13:40:59 -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=ubjQQ41cVavA9QjQ1OCn0rpfi8j/rBG+Hgcb6tjbBiE=; b=w8n/RnyO22XOFDQKFvXm3I7HQRyNFL+8JP+q4SOAgk8MUXSmmOE82TH5QS5gHPb1ms 79A8ASmu89mbrn0+L42oxiuEw57/06NHPUgOm6bK8jWB7S2ehvKyV09v6NMnL5ZJ8Lb6 VPQMDTKfJ39ScAGJgS426xSQ1IhOrzSihCaxK50xh4FQv8Y5t20YTbLJXTjLRXoFeonH 40xjUYhJw07UFz1MatvGRg1VrfXd8iMUDboo50sg1HtPmhxVqXvAmvGFLROJ1yp6EOXc hnm198pZohlpsdXNusT0nmG3Bp1cHSZL+7Iq9tIi5d50GfI+evL7necBtZ1EA/c93MQT K/eA== X-Received: by 10.180.208.13 with SMTP id ma13mr16515351wic.53.1413146459792; Sun, 12 Oct 2014 13:40:59 -0700 (PDT) Received: from tango-charlie.Home ([2.127.193.40]) by mx.google.com with ESMTPSA id y5sm9970930wix.10.2014.10.12.13.40.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 12 Oct 2014 13:40:58 -0700 (PDT) From: "Lad, Prabhakar" To: LMML Subject: [PATCH 06/15] media: davinci: vpbe: use vb2_fop_mmap/poll Date: Sun, 12 Oct 2014 21:40:36 +0100 Message-ID: <1413146445-7304-7-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413146445-7304-1-git-send-email-prabhakar.csengg@gmail.com> References: <1413146445-7304-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=unavailable 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 this patch teaches vpbe driver to use vb2_fop_mmap/poll helpers. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpbe_display.c | 44 ++------------------------- 1 file changed, 3 insertions(+), 41 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 524e1fd..fc3bdb6 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -1341,45 +1341,6 @@ static int vpbe_display_reqbufs(struct file *file, void *priv, } /* - * vpbe_display_mmap() - * It is used to map kernel space buffers into user spaces - */ -static int vpbe_display_mmap(struct file *filep, struct vm_area_struct *vma) -{ - /* Get the layer object and file handle object */ - struct vpbe_fh *fh = filep->private_data; - struct vpbe_layer *layer = fh->layer; - struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; - int ret; - - v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_mmap\n"); - - if (mutex_lock_interruptible(&layer->opslock)) - return -ERESTARTSYS; - ret = vb2_mmap(&layer->buffer_queue, vma); - mutex_unlock(&layer->opslock); - return ret; -} - -/* vpbe_display_poll(): It is used for select/poll system call - */ -static unsigned int vpbe_display_poll(struct file *filep, poll_table *wait) -{ - struct vpbe_fh *fh = filep->private_data; - struct vpbe_layer *layer = fh->layer; - struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; - unsigned int err = 0; - - v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_poll\n"); - if (layer->started) { - mutex_lock(&layer->opslock); - err = vb2_poll(&layer->buffer_queue, filep, wait); - mutex_unlock(&layer->opslock); - } - return err; -} - -/* * vpbe_display_open() * It creates object of file handle structure and stores it in private_data * member of filepointer @@ -1527,8 +1488,8 @@ static struct v4l2_file_operations vpbe_fops = { .open = vpbe_display_open, .release = vpbe_display_release, .unlocked_ioctl = video_ioctl2, - .mmap = vpbe_display_mmap, - .poll = vpbe_display_poll + .mmap = vb2_fop_mmap, + .poll = vb2_fop_poll, }; static int vpbe_device_get(struct device *dev, void *data) @@ -1608,6 +1569,7 @@ static int register_device(struct vpbe_layer *vpbe_display_layer, (int)vpbe_display_layer, (int)&vpbe_display_layer->video_dev); + vpbe_display_layer->video_dev.queue = &vpbe_display_layer->buffer_queue; err = video_register_device(&vpbe_display_layer->video_dev, VFL_TYPE_GRABBER, -1);