Commit 2335e2b817186cf79a07311f14560ef8b30f6a9a
Committed by
Mauro Carvalho Chehab
1 parent
bedf8bcf6b
Exists in
master
and in
4 other branches
[media] v4l2-framework.txt: document new v4l2_device release() callback
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Showing 1 changed file with 15 additions and 0 deletions Side-by-side Diff
Documentation/video4linux/v4l2-framework.txt
... | ... | @@ -181,6 +181,21 @@ |
181 | 181 | state->instance = atomic_inc_return(&drv_instance) - 1; |
182 | 182 | } |
183 | 183 | |
184 | +If you have multiple device nodes then it can be difficult to know when it is | |
185 | +safe to unregister v4l2_device. For this purpose v4l2_device has refcounting | |
186 | +support. The refcount is increased whenever video_register_device is called and | |
187 | +it is decreased whenever that device node is released. When the refcount reaches | |
188 | +zero, then the v4l2_device release() callback is called. You can do your final | |
189 | +cleanup there. | |
190 | + | |
191 | +If other device nodes (e.g. ALSA) are created, then you can increase and | |
192 | +decrease the refcount manually as well by calling: | |
193 | + | |
194 | +void v4l2_device_get(struct v4l2_device *v4l2_dev); | |
195 | + | |
196 | +or: | |
197 | + | |
198 | +int v4l2_device_put(struct v4l2_device *v4l2_dev); | |
184 | 199 | |
185 | 200 | struct v4l2_subdev |
186 | 201 | ------------------ |