From: Wolfgang Denk Date: Sat, 04 Apr 2009 01:24:56 +0200 Subject: [U-Boot] [PATCH] include/ns16550.h: Unify structure declaration for registers In-Reply-To: <1238769946-30370-1-git-send-email-dzu@denx.de> References: <1238769946-30370-1-git-send-email-dzu@denx.de> Message-ID: <20090403232456.48A5A83797DC@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Detlev Zundel, In message <1238769946-30370-1-git-send-email-dzu@denx.de> you wrote: > Instead of special casing the different access patterns, use common > code with light macros sprinkled in to accomodate for the different > layouts of the register structure. > > Note that this also changes the types of the registers for the > "positively packed (>1)" cases. As the registers truly are unsigned > chars, this is surely the Right Thing, but it is a semantic change. > Note that for this case depending on the endianness on the bus, we may > see a change of behaviour. > > Signed-off-by: Detlev Zundel > --- > include/ns16550.h | 130 +++++++++++++++-------------------------------------- > 1 files changed, 37 insertions(+), 93 deletions(-) Applied, thanks. > Note, that I checked that the offsets are ok in the used cases > switching from the old to the new code. They *do* shift however in > the positive packed cases, because the old code uses data types > different than unsigned char. Note that doing this, I also noticed > that using "unsigned long" for 4 byte registers is also no longer true > on 64-bit architectures. One more reason to change the code. > > Apart from that the code was also compile tested on several > configurations using different REG_SIZES and compiles without > warnings. The special interesting case of +4 was successfully tested > on CU824. I guess when this code hits mainline (i. e. now) it will receive a sufficient level of testing :-) Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If A equals success, then the formula is A = X + Y + Z. X is work. Y is play. Z is keep your mouth shut. - Albert Einstein