[U-Boot] [PATCH] Davinci: add a pin multiplexer configuration API

Kim Phillips kim.phillips at freescale.com
Fri Oct 30 15:56:38 CET 2009


On Fri, 30 Oct 2009 09:26:12 +0100
Wolfgang Denk <wd at denx.de> wrote:

> Dear Kim Phillips,
> 
> In message <20091029182304.469c9f7f.kim.phillips at freescale.com> you wrote:
> > if (field < PIN_MUX_NUM_FIELDS &&
> >     (value & ~PIN_MUX_FIELD_MASK) == 0) {
> > 
> > > +			int offset = field * PIN_MUX_FIELD_SIZE;
> > > +			unsigned int mux = pins[i].mux;
> > > +			unsigned int mask = PIN_MUX_FIELD_MASK << offset;
> > 
> > also please just declare everything at the top of the function - same
> > for value and field declarations above.
> 
> No! Why should that be needed? It would be just a waste of stack
> space (except that recent compilers don't care abouyt this anyway),
> and keeping variables as localized as possible seems to be a good
> thing to me.

not when it sacrifices readability.  I'm looking for assignments and
finding 'unsigned'!  Either put a blank line between the declarations
and the rest of the code, or declare everything at the top of the
function, since it does nothing for the compiler (my preference is the
latter in this case).

Kim


More information about the U-Boot mailing list