diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2011-01-08 07:38:02 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 15:37:58 -0400 |
commit | dfddb2441f39e8c0254504516be35b854addf6fa (patch) | |
tree | 7fd4bade365e394e38aee0764adca945a5bf394d /include/media | |
parent | 73cb42068cff419e72456940c713ceb5efa68c2a (diff) |
[media] v4l2-fh: add v4l2_fh_is_singular
Several drivers need to do something when the first filehandle is opened
or the last filehandle is closed. Most implement some use count mechanism,
but if they use v4l2_fh, then you can also just check if this is the only
filehandle for the device node. A simple helper function can do this.
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.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h index 5657881cd44e..0206aa55be24 100644 --- a/include/media/v4l2-fh.h +++ b/include/media/v4l2-fh.h | |||
@@ -77,5 +77,18 @@ void v4l2_fh_exit(struct v4l2_fh *fh); | |||
77 | * v4l2_fh struct) is NULL. This function always returns 0. | 77 | * v4l2_fh struct) is NULL. This function always returns 0. |
78 | */ | 78 | */ |
79 | int v4l2_fh_release(struct file *filp); | 79 | int v4l2_fh_release(struct file *filp); |
80 | /* | ||
81 | * Returns 1 if this filehandle is the only filehandle opened for the | ||
82 | * associated video_device. If fh is NULL, then it returns 0. | ||
83 | */ | ||
84 | int v4l2_fh_is_singular(struct v4l2_fh *fh); | ||
85 | /* | ||
86 | * Helper function with struct file as argument. If filp->private_data is | ||
87 | * NULL, then it will return 0. | ||
88 | */ | ||
89 | static inline int v4l2_fh_is_singular_file(struct file *filp) | ||
90 | { | ||
91 | return v4l2_fh_is_singular(filp->private_data); | ||
92 | } | ||
80 | 93 | ||
81 | #endif /* V4L2_EVENT_H */ | 94 | #endif /* V4L2_EVENT_H */ |