aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-22 08:06:45 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-23 07:04:21 -0400
commit4ada120eaa2d57378b9c270273e8c0b7e542f019 (patch)
tree78f099740e1013228b461bcc4f34c3a88f53c25b /include/media
parentd231685682caa905bd3fee3ae1633e5b219f947c (diff)
[media] v4l2-fh.h: add documentation for it
This header file was undocumented. Add documentation for it. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-fh.h128
1 files changed, 96 insertions, 32 deletions
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
index 803516775162..e19e6246e21c 100644
--- a/include/media/v4l2-fh.h
+++ b/include/media/v4l2-fh.h
@@ -33,6 +33,21 @@
33struct video_device; 33struct video_device;
34struct v4l2_ctrl_handler; 34struct v4l2_ctrl_handler;
35 35
36/**
37 * struct v4l2_fh - Describes a V4L2 file handler
38 *
39 * @list: list of file handlers
40 * @vdev: pointer to &struct video_device
41 * @ctrl_handler: pointer to &struct v4l2_ctrl_handler
42 * @prio: priority of the file handler, as defined by &enum v4l2_priority
43 *
44 * @wait: event' s wait queue
45 * @subscribed: list of subscribed events
46 * @available: list of events waiting to be dequeued
47 * @navailable: number of available events at @available list
48 * @sequence: event sequence number
49 * @m2m_ctx: pointer to &struct v4l2_m2m_ctx
50 */
36struct v4l2_fh { 51struct v4l2_fh {
37 struct list_head list; 52 struct list_head list;
38 struct video_device *vdev; 53 struct video_device *vdev;
@@ -41,8 +56,8 @@ struct v4l2_fh {
41 56
42 /* Events */ 57 /* Events */
43 wait_queue_head_t wait; 58 wait_queue_head_t wait;
44 struct list_head subscribed; /* Subscribed events */ 59 struct list_head subscribed;
45 struct list_head available; /* Dequeueable event */ 60 struct list_head available;
46 unsigned int navailable; 61 unsigned int navailable;
47 u32 sequence; 62 u32 sequence;
48 63
@@ -51,53 +66,102 @@ struct v4l2_fh {
51#endif 66#endif
52}; 67};
53 68
54/* 69/**
55 * Initialise the file handle. Parts of the V4L2 framework using the 70 * v4l2_fh_init - Initialise the file handle.
71 *
72 * @fh: pointer to &struct v4l2_fh
73 * @vdev: pointer to &struct video_device
74 *
75 * Parts of the V4L2 framework using the
56 * file handles should be initialised in this function. Must be called 76 * file handles should be initialised in this function. Must be called
57 * from driver's v4l2_file_operations->open() handler if the driver 77 * from driver's v4l2_file_operations->open\(\) handler if the driver
58 * uses v4l2_fh. 78 * uses &struct v4l2_fh.
59 */ 79 */
60void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev); 80void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
61/* 81
62 * Add the fh to the list of file handles on a video_device. The file 82/**
63 * handle must be initialised first. 83 * v4l2_fh_add - Add the fh to the list of file handles on a video_device.
84 *
85 * @fh: pointer to &struct v4l2_fh
86 *
87 * .. note::
88 * The @fh file handle must be initialised first.
64 */ 89 */
65void v4l2_fh_add(struct v4l2_fh *fh); 90void v4l2_fh_add(struct v4l2_fh *fh);
66/* 91
67 * Can be used as the open() op of v4l2_file_operations. 92/**
68 * It allocates a v4l2_fh and inits and adds it to the video_device associated 93 * v4l2_fh_open - Ancillary routine that can be used as the open\(\) op
69 * with the file pointer. 94 * of v4l2_file_operations.
95 *
96 * @filp: pointer to struct file
97 *
98 * It allocates a v4l2_fh and inits and adds it to the &struct video_device
99 * associated with the file pointer.
70 */ 100 */
71int v4l2_fh_open(struct file *filp); 101int v4l2_fh_open(struct file *filp);
72/* 102
73 * Remove file handle from the list of file handles. Must be called in 103/**
74 * v4l2_file_operations->release() handler if the driver uses v4l2_fh. 104 * v4l2_fh_del - Remove file handle from the list of file handles.
75 * On error filp->private_data will be NULL, otherwise it will point to 105 *
76 * the v4l2_fh struct. 106 * @fh: pointer to &struct v4l2_fh
107 *
108 * On error filp->private_data will be %NULL, otherwise it will point to
109 * the &struct v4l2_fh.
110 *
111 * .. note::
112 * Must be called in v4l2_file_operations->release\(\) handler if the driver
113 * uses &struct v4l2_fh.
77 */ 114 */
78void v4l2_fh_del(struct v4l2_fh *fh); 115void v4l2_fh_del(struct v4l2_fh *fh);
79/* 116
80 * Release resources related to a file handle. Parts of the V4L2 117/**
81 * framework using the v4l2_fh must release their resources here, too. 118 * v4l2_fh_exit - Release resources related to a file handle.
82 * Must be called in v4l2_file_operations->release() handler if the 119 *
83 * driver uses v4l2_fh. 120 * @fh: pointer to &struct v4l2_fh
121 *
122 * Parts of the V4L2 framework using the v4l2_fh must release their
123 * resources here, too.
124 *
125 * .. note::
126 * Must be called in v4l2_file_operations->release\(\) handler if the
127 * driver uses &struct v4l2_fh.
84 */ 128 */
85void v4l2_fh_exit(struct v4l2_fh *fh); 129void v4l2_fh_exit(struct v4l2_fh *fh);
86/* 130
87 * Can be used as the release() op of v4l2_file_operations. 131/**
132 * v4l2_fh_release - Ancillary routine that can be used as the release\(\) op
133 * of v4l2_file_operations.
134 *
135 * @filp: pointer to struct file
136 *
88 * It deletes and exits the v4l2_fh associated with the file pointer and 137 * It deletes and exits the v4l2_fh associated with the file pointer and
89 * frees it. It will do nothing if filp->private_data (the pointer to the 138 * frees it. It will do nothing if filp->private_data (the pointer to the
90 * v4l2_fh struct) is NULL. This function always returns 0. 139 * v4l2_fh struct) is %NULL.
140 *
141 * This function always returns 0.
91 */ 142 */
92int v4l2_fh_release(struct file *filp); 143int v4l2_fh_release(struct file *filp);
93/* 144
94 * Returns 1 if this filehandle is the only filehandle opened for the 145/**
95 * associated video_device. If fh is NULL, then it returns 0. 146 * v4l2_fh_is_singular - Returns 1 if this filehandle is the only filehandle
147 * opened for the associated video_device.
148 *
149 * @fh: pointer to &struct v4l2_fh
150 *
151 * If @fh is NULL, then it returns 0.
96 */ 152 */
97int v4l2_fh_is_singular(struct v4l2_fh *fh); 153int v4l2_fh_is_singular(struct v4l2_fh *fh);
98/* 154
99 * Helper function with struct file as argument. If filp->private_data is 155/**
100 * NULL, then it will return 0. 156 * v4l2_fh_is_singular_file - Returns 1 if this filehandle is the only
157 * filehandle opened for the associated video_device.
158 *
159 * @filp: pointer to struct file
160 *
161 * This is a helper function variant of v4l2_fh_is_singular() with uses
162 * struct file as argument.
163 *
164 * If filp->private_data is %NULL, then it will return 0.
101 */ 165 */
102static inline int v4l2_fh_is_singular_file(struct file *filp) 166static inline int v4l2_fh_is_singular_file(struct file *filp)
103{ 167{