Re: [PATCH RFC v3 6/7] rtl2832_sdr: convert to SDR API

Devin Heitmueller
2013-12-19T19:12:50Z

> I think I could add some lock quite easily. I remember when I implemented
> cxd2820r DVB-T/T2/C demod driver and at the time it implements 2 frontends,
> one for DVB-T/T2 and one for DVB-C. I used shared lock to prevent access
> only for single fe at time. I think same solution works in that case too.

Locking between v4l and dvb is more problematic because of known bugs
related to the dvb_frontend deferring the shutdown of the tuner. As a
result there is a race condition if you try to close the DVB device
and then immediately open the V4L device (which would be a common use
case if using an application like MythTV when switching from digital
to analog mode).

You can't simply add a lock because the V4L side will get hit with
-EBUSY because the DVB frontend hasn't completely shutdown yet.

Unfortunately it's one of those cases where it "seems" easy until you
start scoping out the edge cases and race conditions.

Devin

--
Devin J. Heitmueller - Kernel Labs