Subject: Re: More Device Properties
To: None <eeh@netbsd.org>
From: Chris G. Demetriou <cgd@sibyte.com>
List: tech-kern
Date: 02/14/2001 16:15:56
eeh@netbsd.org writes:
> 	I think probably the right thing is:
> 
> 		* when attaching, copy, and
> 
> 		* let the parent be responsible for marking propdev immutable
> 		  or not (and, of course, destroying it).
> 
> 	That way, you can do whatever you want, and there are no real
> 	surprises.
> 
> Sounds reasonable right now, but if we separate out the 
> `struct device' from the softc then the propdev is transformed
> into the real device at attach time.

I'd still say, in that case, you just make a new one.  I think it'd
simplify the code paths.

After all, for a sane interface, the caller still needs to
destroy/free the 'propdev' when it's done with it...

So, like everything else, just make a copy.  8-)


> Yeah, I originally thought it would be too much work but now
> it seems to be the only really clean solution.  Seems a bit 
> much for 1.6.

Probably.

> It would break *EVERYTHING*.  How do we migrate
> there?  We could have devices that use `aux' have monolithic
> device structures and the others use a separate softc, but
> that would have to be based on the parent bus which registers
> the properties and preclude devices that can attach to both
> types.

Right, so, I think you basically need to do something like:

(1) keep passing in the 'aux' for backward compat. until you know
everything is dead.

(2) as busses are converted, attachments can be converted and/or
pointed to new common property-based match/attach rtns.

You may want to keep separate cfattach structs for a Long Time.

I think the real trick is, setting up some macros, etc., so that
cfattach, etc., can be done in a sane way, without need for touching
all the drivers N times.  I.e. do the thing with a hackishly-passed
4th arg for now, but convert things to use macros/types over time to
declare cfattach & their fns, etc., so that after a while you can just
flip a switch in config.h...


chris