tech-kern archive

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

Re: pseudoify cgd

On Fri, Jan 01, 2010 at 10:29:00AM +0000, Iain Hibbert wrote:
> On Thu, 31 Dec 2009, Quentin Garnier wrote:
> >   - I looked at the code the other day, and I don't see any reason to
> >     allocate a cfdata_t for each device_t.  I'm fairly certain you can
> >     just use a static one common to all instances.  I know all the other
> >     drivers do that, but that's just people copy-pasting code without
> >     really understanding it (I'm just as guilty as the others).
> I looked at that once also and came to the conclusion that while it would
> probably work fine, it was better to allocate because the cfdata is not
> specified as const in any documentation and indeed, config_attach_pseudo()
> does modify it in certain cases which I didn't necessarily understand..

Of course it modifies it.  If it's not a star instance, it has to keep
track that it was found.  If you look at the code, you'll see that a
cfdata_t is only ever modified if it is not a star instance.

How complex it might look, it's easy to understand:  a cfdata_t is a
line in the kernel configuration file, e.g. "driver* at bus? loc ?
flags 0".

Having said that, you might question the utility of a static instance
for a pseudo-device, but maybe someone will have a use for that.

Quentin Garnier - -
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.

Attachment: pgp2ThhS1N9wT.pgp
Description: PGP signature

Home | Main Index | Thread Index | Old Index