]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
V4L/DVB (11785): dvb_frontend: fix race condition resulting in dropped tuning commands
authorDevin Heitmueller <dheitmueller@kernellabs.com>
Tue, 5 May 2009 00:43:02 +0000 (21:43 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 16 Jun 2009 22:14:14 +0000 (19:14 -0300)
commit57594a586f3353286d64c30f397494a834cac238
tree077ba0ba458e51f774f678973b5115115b541fa2
parent06f837cadbcdedb45f0702cb57c99c404ae921e6
V4L/DVB (11785): dvb_frontend: fix race condition resulting in dropped tuning commands

A race condition was detected in the case that putting the tuner to sleep takes
an unusually long period of time, combined with applications that quickly
close/open the dvb frontend.

The kaffeine channel scanner closes and reopens the dvb frontend between each
tuning attempt.  If it takes an unusually longer period of time to put the
tuner to sleep (for example, the Pinnacle 801e takes 660 ms), the dvb_frontend
thread will still be in a running state (and hence fepriv->thread is still set)
but the fepriv->exit field will still be zero.  As a result, if a
dvb_frontend_start() call arrives while the frontend thread is in the process
of terminating, the call will return 0 without actually starting a new thread.
This results in the tuning request being dropped.

To address this, mark fepriv->exit as soon as we know the thread is going to
be terminated, so that dvb_frontend_start() knows to start a new instance.

Problem encountered with Kaffeine 0.8.7 doing ATSC scanning against the
Pinnacle 801e tuner, in conjunction with new code to power down the xc5000
when not in use.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-core/dvb_frontend.c