Re: idea on how to break the static dependencies on demodulator modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 16 May 2006 12:25, Johannes Stezenbach wrote:
> On Tue, May 16, 2006, Andrew de Quincey wrote:
> > On Sunday 14 May 2006 11:38, Johannes Stezenbach wrote:
> > > On Sat, May 13, 2006, Oliver Endriss wrote:
> > > > Is chaining used anywhere else than in the lnbp21 driver?
> > > >
> > > > I introduced it because I thought that it would be a good idea to
> > > > limit the number of private pointers in struct dvb_frontend. ;-)
> > > >
> > > > Obviously it makes life harder, not easier. So just remove chaining
> > > > from lnbp21.[ch], and rename misc_priv to something like sec_priv...
> > > >
> > > > Imho it's not worth the trouble. ;-)
> > >
> > > IMHO this "chaining" of the release function is a bad
> > > concept. The card driver does the attach, so it should also
> > > do the release.
> > >
> > > Consider:
> > > 	foo = foo_attach();
> > > 	bar = bar_attach(foo);
> > > 	...
> > > 	bar->release();
> > > 	// do we leak foo now is it magically cleaned up?
> > >
> > > Please keep it simple and stupid, the four drivers which
> > > use lnbp21 can also keep a lnbp21 pointer around and
> > > release it explicitly.
> >
> > Hmm, well we could make a rule that you never chain the release()
> > function, even though you are allowed to do so for the other function
> > pointers... would this be ok? Then we would always have a pointer to each
> > used module, and hence using symbol_put_addr() would be fine.
>
> IMHO it is the card driver which creates an instance of the
> demod/pll/lnbp etc. driver, so it *owns* the reference. The
> chaining of the fe->ops function pointers is an implementation
> detail, it could e.g. also be implemented by keeping one
> fe->ops per driver and have dvb_frontend call them in order.
>
> So there is a conceptual difference between chaining fe->ops
> and passing ownership to some other module.
>
> IOW, chaining ->release() is not the problem, but having
> ->release() decrement the refcount of some other module is.

Hmm, sorry, not sure what you mean here - where is one module decrementing the 
refcount of another module? Ah, do you mean the symbol_put in the current  
dvb_attach() ?

_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux