From patchwork Mon Feb 22 15:51:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 2784 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Mon, 22 Feb 2010 15:52:32 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Mon, 22 Feb 2010 12:53:19 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NjaaG-0000nJ-Bk; Mon, 22 Feb 2010 15:52:32 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754134Ab0BVPwb (ORCPT + 1 other); Mon, 22 Feb 2010 10:52:31 -0500 Received: from smtp.nokia.com ([192.100.122.233]:18412 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753807Ab0BVPwa (ORCPT ); Mon, 22 Feb 2010 10:52:30 -0500 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o1MFqQM1027637; Mon, 22 Feb 2010 17:52:27 +0200 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 22 Feb 2010 17:52:16 +0200 Received: from mgw-da01.ext.nokia.com ([147.243.128.24]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 22 Feb 2010 17:52:15 +0200 Received: from maxwell.research.nokia.com (nese-loadbalancer-pip.nokia.com [172.16.16.250]) by mgw-da01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o1MFpb5x020326 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Feb 2010 17:51:39 +0200 Received: from kaali.localdomain (kaali.localdomain [192.168.239.7]) by maxwell.research.nokia.com (Postfix) with ESMTPS id 8EC7C700C3; Mon, 22 Feb 2010 17:51:37 +0200 (EET) Received: from sailus by kaali.localdomain with local (Exim 4.69) (envelope-from ) id 1NjaZN-0006i8-GM; Mon, 22 Feb 2010 17:51:37 +0200 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: laurent.pinchart@nokia.com, hverkuil@xs4all.nl, david.cohen@nokia.com Subject: [PATCH 2/6] V4L: File handles: Add documentation Date: Mon, 22 Feb 2010 17:51:33 +0200 Message-Id: <1266853897-25749-2-git-send-email-sakari.ailus@maxwell.research.nokia.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1266853897-25749-1-git-send-email-sakari.ailus@maxwell.research.nokia.com> References: <4B82A7FB.50505@maxwell.research.nokia.com> <1266853897-25749-1-git-send-email-sakari.ailus@maxwell.research.nokia.com> X-OriginalArrivalTime: 22 Feb 2010 15:52:16.0029 (UTC) FILETIME=[01A324D0:01CAB3D7] X-Nokia-AV: Clean Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add documentation on using V4L2 file handles (v4l2_fh) in V4L2 drivers. Signed-off-by: Sakari Ailus Reviewed-by: Hans Verkuil --- Documentation/video4linux/v4l2-framework.txt | 37 ++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index 74d677c..bfaf0c5 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt @@ -695,3 +695,40 @@ The better way to understand it is to take a look at vivi driver. One of the main reasons for vivi is to be a videobuf usage example. the vivi_thread_tick() does the task that the IRQ callback would do on PCI drivers (or the irq callback on USB). + +struct v4l2_fh +-------------- + +struct v4l2_fh provides a way to easily keep file handle specific data +that is used by the V4L2 framework. + +struct v4l2_fh is allocated as a part of the driver's own file handle +structure and is set to file->private_data in the driver's open +function by the driver. Drivers can extract their own file handle +structure by using the container_of macro. + +Useful functions: + +- v4l2_fh_init() + + Initialise the file handle. This *MUST* be performed in the driver's + v4l2_file_operations->open() handler. + +- v4l2_fh_add() + + Add a v4l2_fh to video_device file handle list. May be called after + initialising the file handle. + +- v4l2_fh_del() + + Unassociate the file handle from video_device(). The file handle + exit function may now be called. + +- v4l2_fh_exit() + + Uninitialise the file handle. After uninitialisation the v4l2_fh + memory can be freed. + +The users of v4l2_fh know whether a driver uses v4l2_fh as its +file->private_data pointer by testing the V4L2_FL_USES_V4L2_FH bit in +video_device->flags.