1*1babcb46SSakari Ailus /* 2*1babcb46SSakari Ailus * v4l2-fh.h 3*1babcb46SSakari Ailus * 4*1babcb46SSakari Ailus * V4L2 file handle. Store per file handle data for the V4L2 5*1babcb46SSakari Ailus * framework. Using file handles is optional for the drivers. 6*1babcb46SSakari Ailus * 7*1babcb46SSakari Ailus * Copyright (C) 2009--2010 Nokia Corporation. 8*1babcb46SSakari Ailus * 9*1babcb46SSakari Ailus * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 10*1babcb46SSakari Ailus * 11*1babcb46SSakari Ailus * This program is free software; you can redistribute it and/or 12*1babcb46SSakari Ailus * modify it under the terms of the GNU General Public License 13*1babcb46SSakari Ailus * version 2 as published by the Free Software Foundation. 14*1babcb46SSakari Ailus * 15*1babcb46SSakari Ailus * This program is distributed in the hope that it will be useful, but 16*1babcb46SSakari Ailus * WITHOUT ANY WARRANTY; without even the implied warranty of 17*1babcb46SSakari Ailus * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18*1babcb46SSakari Ailus * General Public License for more details. 19*1babcb46SSakari Ailus * 20*1babcb46SSakari Ailus * You should have received a copy of the GNU General Public License 21*1babcb46SSakari Ailus * along with this program; if not, write to the Free Software 22*1babcb46SSakari Ailus * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 23*1babcb46SSakari Ailus * 02110-1301 USA 24*1babcb46SSakari Ailus */ 25*1babcb46SSakari Ailus 26*1babcb46SSakari Ailus #ifndef V4L2_FH_H 27*1babcb46SSakari Ailus #define V4L2_FH_H 28*1babcb46SSakari Ailus 29*1babcb46SSakari Ailus #include <linux/list.h> 30*1babcb46SSakari Ailus 31*1babcb46SSakari Ailus struct video_device; 32*1babcb46SSakari Ailus 33*1babcb46SSakari Ailus struct v4l2_fh { 34*1babcb46SSakari Ailus struct list_head list; 35*1babcb46SSakari Ailus struct video_device *vdev; 36*1babcb46SSakari Ailus }; 37*1babcb46SSakari Ailus 38*1babcb46SSakari Ailus /* 39*1babcb46SSakari Ailus * Initialise the file handle. Parts of the V4L2 framework using the 40*1babcb46SSakari Ailus * file handles should be initialised in this function. Must be called 41*1babcb46SSakari Ailus * from driver's v4l2_file_operations->open() handler if the driver 42*1babcb46SSakari Ailus * uses v4l2_fh. 43*1babcb46SSakari Ailus */ 44*1babcb46SSakari Ailus int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev); 45*1babcb46SSakari Ailus /* 46*1babcb46SSakari Ailus * Add the fh to the list of file handles on a video_device. The file 47*1babcb46SSakari Ailus * handle must be initialised first. 48*1babcb46SSakari Ailus */ 49*1babcb46SSakari Ailus void v4l2_fh_add(struct v4l2_fh *fh); 50*1babcb46SSakari Ailus /* 51*1babcb46SSakari Ailus * Remove file handle from the list of file handles. Must be called in 52*1babcb46SSakari Ailus * v4l2_file_operations->release() handler if the driver uses v4l2_fh. 53*1babcb46SSakari Ailus */ 54*1babcb46SSakari Ailus void v4l2_fh_del(struct v4l2_fh *fh); 55*1babcb46SSakari Ailus /* 56*1babcb46SSakari Ailus * Release resources related to a file handle. Parts of the V4L2 57*1babcb46SSakari Ailus * framework using the v4l2_fh must release their resources here, too. 58*1babcb46SSakari Ailus * Must be called in v4l2_file_operations->release() handler if the 59*1babcb46SSakari Ailus * driver uses v4l2_fh. 60*1babcb46SSakari Ailus */ 61*1babcb46SSakari Ailus void v4l2_fh_exit(struct v4l2_fh *fh); 62*1babcb46SSakari Ailus 63*1babcb46SSakari Ailus #endif /* V4L2_EVENT_H */ 64