From: Wolfgang Denk Date: Thu, 03 Jan 2013 11:31:59 +0100 Subject: [U-Boot] [PATCH] drivers/block/systemace: fixes read/write words for bus width = 8 In-Reply-To: References: <1357137512-8618-1-git-send-email-alexey.brodkin@gmail.com> <20130102202600.83A3920035D@gemini.denx.de> <20130103074402.DCA3E200781@gemini.denx.de> Message-ID: <20130103103159.719C4200781@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 Michal Simek, In message you wrote: > > > I see. Well, I think the commit message is not really clear. I > > definitely misunderstood it. Maybe it can be improved? > > Yep. Thanks. > btw: is there any coding style rule about this second function > > Current (simplified) case. > static u16 ace_readw(unsigned off) > { > if (width == 8) > return readb(base + off) | (readb(base + off + 1) << 8); > > return readw(base + off); > } > > or (with else) > > static u16 ace_readw(unsigned off) > { > if (width == 8) > return readb(base + off) | (readb(base + off + 1) << 8); > else > return readw(base + off); > } I am not aware of a CodingStyle rule; in this example there is also not much difference due to the simplicity of the code (note however that indentation of the second return is incorrect in the second example). My personal preference is the first example, as it uses minimal nesting; I feel this is easier to read. 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 A door is what a dog is perpetually on the wrong side of. - Ogden Nash