OSDN Git Service

[media] soc-camera: properly fix camera probing races
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Thu, 20 Dec 2012 16:02:51 +0000 (13:02 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 5 Jan 2013 03:35:35 +0000 (01:35 -0200)
commit7d051b35d5196ad6011a17e751dbd3d180abb046
tree718bd75e1967da3d27861ee7a1fc15ca2f015492
parentdaf16bab1eaf5a82217697bfb91eb7d9c9745d0d
[media] soc-camera: properly fix camera probing races

The recently introduced host_lock causes lockdep warnings, besides, list
enumeration in scan_add_host() must be protected by holdint the list_lock.
OTOH, holding .video_lock in soc_camera_open() isn't enough to protect
the host during its building of the pipeline, because .video_lock is per
soc-camera device. If, e.g. more than one sensor can be attached to a host
and the user tries to open both device nodes simultaneously, host's .add()
method can be called simultaneously for both sensors. Fix these problems
by holding list_lock instead of .host_lock in scan_add_host() and taking
it shortly at the beginning of soc_camera_open(), and using .host_lock to
protect host's .add() and .remove() operations only.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/platform/soc_camera/soc_camera.c
include/media/soc_camera.h