Mailing List archive

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

[linux-dvb] Re: refactoring



On Friday 08 Oct 2004 16:22, Gerd Knorr wrote:
> > > > > There is no private data any longer.
> > > >
> > > > Yes, I've seen the code now.  Thats is a serve design bug.  The
> > > > drivers private data should not be public.  And it should be
> > > > allocated and freed by the driver itself and not by someone else.
> > >
> > > My take on this was that the demod drivers are meant to be as simple
> > > and as small as possible. I didn't really see the point in hiding the
> > > private data with this in mind.
> >
> > Don't think of the demodulators as seperate drivers - they're not. The
> > refactoring turns the "frontend drivers" into a library of routines used
> > by specific card implementations. My view is that the card drivers should
> > therefore allocate the memory needed by the library routines.
>
> Even a sane designed library will allocate and release the data
> structures itself and *not* ask the user of the library to do that.
> Data structures which are private (to the driver, to library or whatever
> you prefeare to call it) should be maintained by the owner and not
> someone else.  Not designing it this way is just insane and asking for
> trouble, please don't.

You can find examples of exactly this approach all over the kernel. Look at 
i2c_adapter for example - there are several fields defined in there that 
should not be messed with by anything outside the i2c core. Nothing is 
stopping you for mucking about with the list of clients directly - but you'd 
be mad if you did.

This is pragmatism - hiding data is good I agree. However, there comes a time 
when it is simply not worth the extra hassle. 




Home | Main Index | Thread Index