[linux-dvb] [PATCH] add device node locking possibility to dvbcore

Trent Piepho xyzzy at speakeasy.org
Sat Aug 18 09:35:26 CEST 2007

On Fri, 17 Aug 2007, Markus Rechberger wrote:
> > > as I wrote earlier the thread can be idle/closed even before the node
> > > gets closed (you can test that with kaffeine, and you can test the
> > > other case with the scan utility)
> >
> > How can this happen? Afaics the fe thread may continue to exist after
> > the device node was closed, but not vice-versa.

Yes, how can that happen?  What will make the dvb frontend thread exit before
the device is closed?

Maybe it would be a good idea to do what Andreas suggested and have the
frontend release function block until the frontend thread has exited.  AFAIK,
the thread hanging around after the device is closed does nothing but cause
problems.  It's a very common FAQ, "Q:  Why does it mythtv not work if I
change from a digital channel to an analog one?  A:  You need to set
dvb_shutdown_timeout to 0." What's the purpose of dvb_shutdown_timeout > 0?

> > ts_bus_ctrl does a kind of reference counting.
> >
> > For readers:
> > - fe->ops.ts_bus_ctrl(fe,1) is called during open
> > - fe->ops.ts_bus_ctrl(fe,0) is called during close
> >
> > For the one and only writer:
> > - fe->ops.ts_bus_ctrl(fe,1) is called during open
> > - fe->ops.ts_bus_ctrl(fe,0) is called when the thread exits,
> >   usually after close

So, how do you tell if the ts bus is already locked?

> I didn't want to write it but this is also what I would do, and I
> would also include the other dvb device nodes.. it doesn't make sense
> to keep them open as non functional dummies, or even allow people to
> open these nodes if the dvb mode is locked.

What about a device with two frontends?  Maybe the DVB-T/Analog frontend is
locked by the V4L device, but you can still use a DVB-S frontend with dvb.  In
that case the demux could still be opened and used.

More information about the linux-dvb mailing list