• Hans Verkuil's avatar
    media: hdpvr: fix locking and a missing msleep · 6bc5a4a1
    Hans Verkuil authored
    This driver has three locking issues:
    
    - The wait_event_interruptible() condition calls hdpvr_get_next_buffer(dev)
      which uses a mutex, which is not allowed. Rewrite with list_empty_careful()
      that doesn't need locking.
    
    - In hdpvr_read() the call to hdpvr_stop_streaming() didn't lock io_mutex,
      but it should have since stop_streaming expects that.
    
    - In hdpvr_device_release() io_mutex was locked when calling flush_work(),
      but there it shouldn't take that mutex since the work done by flush_work()
      also wants to lock that mutex.
    
    There are also two other changes (suggested by Keith):
    
    - msecs_to_jiffies(4000); (a NOP) should have been msleep(4000).
    - Change v4l2_dbg to v4l2_info to always log if streaming had to be restarted.
    Reported-by: default avatarKeith Pyle <kpyle@austin.rr.com>
    Suggested-by: default avatarKeith Pyle <kpyle@austin.rr.com>
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
    6bc5a4a1
hdpvr-video.c 31 KB