• Hans Verkuil's avatar
    media: vivid: fix 'disconnect' error injection · 9e5f21d6
    Hans Verkuil authored
    The 'disconnect' error injection functionality suffered from bit rot.
    
    New device nodes were added without updating vivid_user_gen_s_ctrl(), so
    that function had to be updated for the new device nodes.
    
    Also, vivid didn't check if specific device nodes were actually ever
    created, so the vivid_is_last_user() would fail on that (it would return
    true instead of false in that case).
    
    Finally, selecting Disconnect, then unbind the vivid driver would fail
    since the remove() would think that the device nodes were already
    unregistered. Keep track of whether disconnect was pressed and re-register
    the device nodes in remove() before doing the real unregister.
    
    [hverkuil: unsigned uses -> unsigned int uses]
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    9e5f21d6
vivid-core.c 66.8 KB