From: Kim Phillips Date: Fri, 30 Oct 2009 11:30:37 -0500 Subject: [U-Boot] [PATCH] Davinci: add a pin multiplexer configuration API In-Reply-To: <610D18D1F0BB204D8AB39BB1C42187E8042B6753@LONMLVEM09.e2k.ad.ge.com> References: <4AE9B6EA.9080206@gefanuc.com> <20091029182304.469c9f7f.kim.phillips@freescale.com> <20091030082612.62AFCC88C8@gemini.denx.de> <20091030095638.c21ee802.kim.phillips@freescale.com> <610D18D1F0BB204D8AB39BB1C42187E8042B6753@LONMLVEM09.e2k.ad.ge.com> Message-ID: <20091030113037.7f57db44.kim.phillips@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, 30 Oct 2009 15:17:40 +0000 "Thompson, Nick (GE EntSol, Intelligent Platforms)" wrote: > > From: Kim Phillips [mailto:kim.phillips at freescale.com] > Sent: 30 October 2009 14:57 > > On Fri, 30 Oct 2009 09:26:12 +0100 > > Wolfgang Denk wrote: > > > > > Dear Kim Phillips, > > > > > > In message <20091029182304.469c9f7f.kim.phillips@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 > > All three of these declarations could be const, which may or may not > help the compiler, but would be technically correct and document my > intentions better. > > This would not be possible if they where moved to the start of the > function or if the declaration and assignments where split up in any > other way. Even with a blank line? Either comply to the level of compiler effectiveness you seek, or make the code more readable for the rest of us. Kim