From patchwork Fri Feb 19 19:21:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 2761 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Fri, 19 Feb 2010 19:22:13 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Fri, 19 Feb 2010 17:24:20 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NiYQW-0002Sn-Nz; Fri, 19 Feb 2010 19:22:12 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755412Ab0BSTWL (ORCPT + 1 other); Fri, 19 Feb 2010 14:22:11 -0500 Received: from smtp.nokia.com ([192.100.122.230]:29442 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755011Ab0BSTWJ (ORCPT ); Fri, 19 Feb 2010 14:22:09 -0500 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o1JJM3L8031897; Fri, 19 Feb 2010 21:22:04 +0200 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 19 Feb 2010 21:22:03 +0200 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 19 Feb 2010 21:22:02 +0200 Received: from maxwell.research.nokia.com (maxwell.research.nokia.com [172.21.50.162]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o1JJM12n017912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 19 Feb 2010 21:22:01 +0200 Received: from kaali.localdomain (kaali.localdomain [192.168.239.7]) by maxwell.research.nokia.com (Postfix) with ESMTPS id E1BB8700C3; Fri, 19 Feb 2010 21:22:00 +0200 (EET) Received: from sailus by kaali.localdomain with local (Exim 4.69) (envelope-from ) id 1NiYQK-0002be-R3; Fri, 19 Feb 2010 21:22:00 +0200 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, iivanov@mm-sol.com, gururaj.nagendra@intel.com, david.cohen@nokia.com, Sakari Ailus Subject: [PATCH v5 2/6] V4L: File handles: Add documentation Date: Fri, 19 Feb 2010 21:21:56 +0200 Message-Id: <1266607320-9974-2-git-send-email-sakari.ailus@maxwell.research.nokia.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <4B7EE4A4.3080202@maxwell.research.nokia.com> References: <4B7EE4A4.3080202@maxwell.research.nokia.com> X-OriginalArrivalTime: 19 Feb 2010 19:22:02.0728 (UTC) FILETIME=[D0A7BE80:01CAB198] 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 --- Documentation/video4linux/v4l2-framework.txt | 36 ++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index 74d677c..08f9e59 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt @@ -695,3 +695,39 @@ 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. + +- 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.