11babcb46SSakari Ailus /* 21babcb46SSakari Ailus * v4l2-fh.h 31babcb46SSakari Ailus * 41babcb46SSakari Ailus * V4L2 file handle. Store per file handle data for the V4L2 51babcb46SSakari Ailus * framework. Using file handles is optional for the drivers. 61babcb46SSakari Ailus * 71babcb46SSakari Ailus * Copyright (C) 2009--2010 Nokia Corporation. 81babcb46SSakari Ailus * 91babcb46SSakari Ailus * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 101babcb46SSakari Ailus * 111babcb46SSakari Ailus * This program is free software; you can redistribute it and/or 121babcb46SSakari Ailus * modify it under the terms of the GNU General Public License 131babcb46SSakari Ailus * version 2 as published by the Free Software Foundation. 141babcb46SSakari Ailus * 151babcb46SSakari Ailus * This program is distributed in the hope that it will be useful, but 161babcb46SSakari Ailus * WITHOUT ANY WARRANTY; without even the implied warranty of 171babcb46SSakari Ailus * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 181babcb46SSakari Ailus * General Public License for more details. 191babcb46SSakari Ailus * 201babcb46SSakari Ailus * You should have received a copy of the GNU General Public License 211babcb46SSakari Ailus * along with this program; if not, write to the Free Software 221babcb46SSakari Ailus * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 231babcb46SSakari Ailus * 02110-1301 USA 241babcb46SSakari Ailus */ 251babcb46SSakari Ailus 261babcb46SSakari Ailus #ifndef V4L2_FH_H 271babcb46SSakari Ailus #define V4L2_FH_H 281babcb46SSakari Ailus 291babcb46SSakari Ailus #include <linux/list.h> 301babcb46SSakari Ailus 311babcb46SSakari Ailus struct video_device; 32*c3b5b024SSakari Ailus struct v4l2_events; 331babcb46SSakari Ailus 341babcb46SSakari Ailus struct v4l2_fh { 351babcb46SSakari Ailus struct list_head list; 361babcb46SSakari Ailus struct video_device *vdev; 37*c3b5b024SSakari Ailus struct v4l2_events *events; /* events, pending and subscribed */ 381babcb46SSakari Ailus }; 391babcb46SSakari Ailus 401babcb46SSakari Ailus /* 411babcb46SSakari Ailus * Initialise the file handle. Parts of the V4L2 framework using the 421babcb46SSakari Ailus * file handles should be initialised in this function. Must be called 431babcb46SSakari Ailus * from driver's v4l2_file_operations->open() handler if the driver 441babcb46SSakari Ailus * uses v4l2_fh. 451babcb46SSakari Ailus */ 461babcb46SSakari Ailus int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev); 471babcb46SSakari Ailus /* 481babcb46SSakari Ailus * Add the fh to the list of file handles on a video_device. The file 491babcb46SSakari Ailus * handle must be initialised first. 501babcb46SSakari Ailus */ 511babcb46SSakari Ailus void v4l2_fh_add(struct v4l2_fh *fh); 521babcb46SSakari Ailus /* 531babcb46SSakari Ailus * Remove file handle from the list of file handles. Must be called in 541babcb46SSakari Ailus * v4l2_file_operations->release() handler if the driver uses v4l2_fh. 551babcb46SSakari Ailus */ 561babcb46SSakari Ailus void v4l2_fh_del(struct v4l2_fh *fh); 571babcb46SSakari Ailus /* 581babcb46SSakari Ailus * Release resources related to a file handle. Parts of the V4L2 591babcb46SSakari Ailus * framework using the v4l2_fh must release their resources here, too. 601babcb46SSakari Ailus * Must be called in v4l2_file_operations->release() handler if the 611babcb46SSakari Ailus * driver uses v4l2_fh. 621babcb46SSakari Ailus */ 631babcb46SSakari Ailus void v4l2_fh_exit(struct v4l2_fh *fh); 641babcb46SSakari Ailus 651babcb46SSakari Ailus #endif /* V4L2_EVENT_H */ 66