From patchwork Wed Jan 6 20:26:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 7970571 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 204A9BEEED for ; Wed, 6 Jan 2016 20:27:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46F3320154 for ; Wed, 6 Jan 2016 20:27:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3250120155 for ; Wed, 6 Jan 2016 20:27:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752011AbcAFU1s (ORCPT ); Wed, 6 Jan 2016 15:27:48 -0500 Received: from resqmta-po-05v.sys.comcast.net ([96.114.154.164]:36825 "EHLO resqmta-po-05v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752160AbcAFU1c (ORCPT ); Wed, 6 Jan 2016 15:27:32 -0500 Received: from resomta-po-09v.sys.comcast.net ([96.114.154.233]) by resqmta-po-05v.sys.comcast.net with comcast id 2kTW1s00P52QWKC01kTWEN; Wed, 06 Jan 2016 20:27:30 +0000 Received: from mail.gonehiking.org ([73.181.52.62]) by resomta-po-09v.sys.comcast.net with comcast id 2kTU1s00J1LXgTt01kTUDh; Wed, 06 Jan 2016 20:27:30 +0000 Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id F3D289F43A; Wed, 6 Jan 2016 13:27:26 -0700 (MST) From: Shuah Khan To: mchehab@osg.samsung.com, tiwai@suse.com, clemens@ladisch.de, hans.verkuil@cisco.com, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, javier@osg.samsung.com Cc: Shuah Khan , pawel@osciak.com, m.szyprowski@samsung.com, kyungmin.park@samsung.com, perex@perex.cz, arnd@arndb.de, dan.carpenter@oracle.com, tvboxspy@gmail.com, crope@iki.fi, ruchandani.tina@gmail.com, corbet@lwn.net, chehabrafael@gmail.com, k.kozlowski@samsung.com, stefanr@s5r6.in-berlin.de, inki.dae@samsung.com, jh1009.sung@samsung.com, elfring@users.sourceforge.net, prabhakar.csengg@gmail.com, sw0312.kim@samsung.com, p.zabel@pengutronix.de, ricardo.ribalda@gmail.com, labbott@fedoraproject.org, pierre-louis.bossart@linux.intel.com, ricard.wanderlof@axis.com, julian@jusst.de, takamichiho@gmail.com, dominic.sacre@gmx.de, misterpib@gmail.com, daniel@zonque.org, gtmkramer@xs4all.nl, normalperson@yhbt.net, joe@oampo.co.uk, linuxbugs@vittgam.net, johan@oljud.se, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-api@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 09/31] media: v4l2-core add v4l_vb2q_enable_media_tuner() helper Date: Wed, 6 Jan 2016 13:26:58 -0700 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: In-Reply-To: References: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1452112050; bh=cX9dBoWXZagsyQ4ZAiiATe9d7wvEn/HI1o30iU721K8=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=j+asWU5yFkL0smAQBOhUhSB45b5bZt3edQdXXYdoC05sOQDuL2fDlXOkeDG72jLTm 8mrOJgIrvbTmL4qDQs83KZt2hrte2pXtSMgnYAHZL3TO0nDvnfKRHmjEFl8DrSVg/D hoj5tyXSe9HQVsf1ywlqYEUeK3sKmK087pT75i74oPQEFPxVWuXTwln91rHLv8Gbxb LHC3cQUmvRP/dDmzGzbMe7Vw2aGhyeyuvk7dkMreW2pPz3a0cgJwHLTWqxsgEJVSgm 5CUcwEJ3kZPmp2NeAmPht4rQFjE0zSyxM8BKyXE8rCZUOLe36XjLAOOlPl5tVPbVHy NRGNRMR3mREgQ== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,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 Add a new v4l_vb2q_enable_media_tuner() wrapper function to be called from v4l2-core to enable the media tuner with videobuf2 queue, when the calling frunction has the videobuf2 queue and doesn't have the struct video_device associated with the queue handy as in the case of vb2_core_streamon(). This function simply calls v4l_enable_media_tuner() passing in the pointer to struct video_device. Signed-off-by: Shuah Khan --- drivers/media/v4l2-core/v4l2-dev.c | 21 +++++++++++++++++++++ include/media/v4l2-dev.h | 1 + 2 files changed, 22 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index f06da6e..9ef675a 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -30,6 +30,7 @@ #include #include #include +#include #define VIDEO_NUM_DEVICES 256 #define VIDEO_NAME "video4linux" @@ -261,6 +262,26 @@ void v4l_disable_media_tuner(struct video_device *vdev) } EXPORT_SYMBOL_GPL(v4l_disable_media_tuner); +/** + * v4l_vb2q_enable_media_tuner - Wrapper for v4l_enable_media_tuner() + * @q: videobuf2 queue + * + * This function is intended to be called from v4l2-core + * to enable the media tuner with videobuf2 queue, when + * the calling frunction has the videobuf2 queue and doesn't + * have the struct video_device associated with the + * queue handy as in the case of vb2_core_streamon(). This + * function simply calls v4l_enable_media_tuner() passing + * in the pointer to struct video_device. + */ +int v4l_vb2q_enable_media_tuner(struct vb2_queue *q) +{ + struct v4l2_fh *fh = q->owner; + + return v4l_enable_media_tuner(fh->vdev); +} +EXPORT_SYMBOL_GPL(v4l_vb2q_enable_media_tuner); + /* Priority handling */ static inline bool prio_is_valid(enum v4l2_priority prio) diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 68999a3..1948097 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -179,6 +179,7 @@ struct video_device * __must_check video_device_alloc(void); int v4l_enable_media_tuner(struct video_device *vdev); void v4l_disable_media_tuner(struct video_device *vdev); +int v4l_vb2q_enable_media_tuner(struct vb2_queue *q); /* this release function frees the vdev pointer */ void video_device_release(struct video_device *vdev);