]> git.karo-electronics.de Git - karo-tx-linux.git/commit
[media] pwc: rework locking
authorHans de Goede <hdegoede@redhat.com>
Sun, 9 Oct 2011 12:16:46 +0000 (09:16 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 26 Nov 2011 15:42:43 +0000 (13:42 -0200)
commit3fa3c1120a1f9c77d7fe1933d8e89590078c4714
treeee6883c35610fb74abdb851ee703ba96064b71da
parent51456c42c6d1a35a89e5b6e8041686d2f7ca6546
[media] pwc: rework locking

While testing gtk-v4l's new ctrl event code, I hit the following deadlock
in the pwc driver:

Thread 1:
 significant amount of time and we don't want to block DQBUF / QBUF too long
Thread 2:
Thread 1:
 unlock that

Now we have thread 1 waiting for the modlock while holding the ctrl_handler
lock and thread 2 waiting for the ctrl_handler lock while holding the
modlock -> deadlock.

1) We cannot unlock modlock from pwc_s_ctrl / pwc_g_volatile_ctrl,
   but this can cause QBUF / DQBUF to block for up to a full second
2) After evaluating various option I came to the conclusion that pwc should
   stop using the v4l2 core locking, and instead do its own locking

Thus this patch stops pwc using the v4l2 core locking, and replaces that with
it doing its own locking where necessary.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/pwc/pwc-ctrl.c
drivers/media/video/pwc/pwc-dec23.c
drivers/media/video/pwc/pwc-dec23.h
drivers/media/video/pwc/pwc-if.c
drivers/media/video/pwc/pwc-v4l.c
drivers/media/video/pwc/pwc.h