[U-Boot] [PATCH] drivers/block/systemace: fixes read/write words for bus width = 8

Michal Simek monstr at monstr.eu
Thu Jan 3 11:33:51 CET 2013


2013/1/3 Wolfgang Denk <wd at denx.de>:
> Dear Michal Simek,
>
> In message <CAHTX3dLGmpBLxwYPdK2Fju4J7t8i+55L3h27O2HcxxcvJW-bxA at mail.gmail.com> 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.

For me too.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian


More information about the U-Boot mailing list