• Hans Verkuil's avatar
    [media] v4l2-device: add kref and a release function · bedf8bcf
    Hans Verkuil authored
    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: default avatarHans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
    bedf8bcf
v4l2-device.h 7.09 KB