summaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2011-01-08 09:36:04 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 16:37:57 -0300
commit73cb42068cff419e72456940c713ceb5efa68c2a (patch)
tree2e2cfa9f87b584774a7dc496ec6b46431bd7ce56 /include/media
parentfc5602be7ca5b55174c5d6595089718779b28dfa (diff)
downloadop-kernel-dev-73cb42068cff419e72456940c713ceb5efa68c2a.zip
op-kernel-dev-73cb42068cff419e72456940c713ceb5efa68c2a.tar.gz
[media] v4l2-fh: add v4l2_fh_open and v4l2_fh_release helper functions
Add two new functions: v4l2_fh_open allocates and initializes a struct v4l2_fh based on a struct file pointer and v4l2_fh_release releases and frees a struct v4l2_fh. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-fh.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
index 5fc5ba9..5657881 100644
--- a/include/media/v4l2-fh.h
+++ b/include/media/v4l2-fh.h
@@ -51,8 +51,16 @@ int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
*/
void v4l2_fh_add(struct v4l2_fh *fh);
/*
+ * Can be used as the open() op of v4l2_file_operations.
+ * It allocates a v4l2_fh and inits and adds it to the video_device associated
+ * with the file pointer.
+ */
+int v4l2_fh_open(struct file *filp);
+/*
* Remove file handle from the list of file handles. Must be called in
* v4l2_file_operations->release() handler if the driver uses v4l2_fh.
+ * On error filp->private_data will be NULL, otherwise it will point to
+ * the v4l2_fh struct.
*/
void v4l2_fh_del(struct v4l2_fh *fh);
/*
@@ -62,5 +70,12 @@ void v4l2_fh_del(struct v4l2_fh *fh);
* driver uses v4l2_fh.
*/
void v4l2_fh_exit(struct v4l2_fh *fh);
+/*
+ * Can be used as the release() op of v4l2_file_operations.
+ * It deletes and exits the v4l2_fh associated with the file pointer and
+ * frees it. It will do nothing if filp->private_data (the pointer to the
+ * v4l2_fh struct) is NULL. This function always returns 0.
+ */
+int v4l2_fh_release(struct file *filp);
#endif /* V4L2_EVENT_H */
OpenPOWER on IntegriCloud