]> git.baikalelectronics.ru Git - kernel.git/commit
[media] v4l2-device: add kref and a release function
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 12 Mar 2011 09:37:19 +0000 (06:37 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 22 Mar 2011 19:38:05 +0000 (16:38 -0300)
commit31efbb2a3e280609579156036fa5c94cd9e05903
tree855560191d12dc9f21db59fca801c67f036b5167
parent157529e820f91c49a948c2494e61caffde9e94b8
[media] v4l2-device: add kref and a release function

The video_device struct has proper ref counting and its release function
will be called when the last user releases it. But no such support was
available for struct v4l2_device. This made it hard to determine when a
USB driver can release the device if it has multiple device nodes.

With one device node it is easy of course, since when the device node is
released, the whole device can be released.

This patch adds refcounting to v4l2_device. When registering device nodes
the v4l2_device refcount will be increased, when releasing device nodes
it will be decreased. The (optional) release function will be called when
the last device node was released.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-dev.c
drivers/media/video/v4l2-device.c
include/media/v4l2-device.h