[linux-dvb] [PATCH] function for checking if the dvb framework is idle
mkrufky at linuxtv.org
Tue Aug 14 17:52:48 CEST 2007
Markus Rechberger wrote:
> On 8/14/07, Christoph Pfister <christophpfister at gmail.com> wrote:
>> Hi Markus,
>> [ although you shouldn't overrate my opinion here I'm giving my $0.02 ]
>> The problem with this approach are race conditions.
>> You can't reliably use the result of this function if you don't ensure
>> that no thread is started during / after the query. As far as I
>> understood your idea you try to solve this issue with the
>> allow-dvb-files-to-be-locked patch. But that patch doesn't handle file
>> descriptors which have been opened before you did the "lock".
>> Of course you can do additional work to fix that too - but imho the
>> easier (and safer from a design-pov) approach is to do the locking at
>> the bridge level as Steve did. I don't think that there are issues
>> with handling it there - as neither dvb-core nor the frontends access
>> the device directly (dvb-core via callbacks and the frontend via i2c
>> adapter). Or do I miss something here?
> There's some other code for checking if the filehandles are open but I
> don't need that patch to go into the framework, it will be stored in
> the local driver.
> For now my aim is to bring in the most needed patches in and nothing else.
You seem to be avoiding the issue.
Christoph is trying to explain to you the same idea that I have tried to explain
to you in the past -- locking of the device for use between analog and digital
should take place at the bridge driver level.
This is what Steve Toth has done for the :8802 port in the cx88 driver, by only
allowing cx88-blackbird -or- cx88-dvb to use the hardware at any given moment.
Since it is the bridge hardware that determines whether or not the device is a
combo device (both analog and digital can be used concurrently) or a hybrid
device (only analog or digital can be used, one at a time), and it is the bridge
hardware itself, that has the limitation. the locking is only appropriate at the
level of the bridge driver itself.
More information about the linux-dvb