[U-Boot] [PATCH v2 13/22] omap4: add clock support

Aneesh V aneesh at ti.com
Sat Jun 25 14:05:44 CEST 2011


Dear Wolfgang,

On Wednesday 18 May 2011 03:14 AM, Wolfgang Denk wrote:
> Dear Aneesh V,
>
[snip ...]
>>> NAK.  We do not accept base address plus offset notation.  Please
>>> declare C structs instead.
>>>
>>
>> Ok. will do.
>>
>> Again just curious, what's the reasoning behind this policy? Is it just
>> aesthetics or something more?
>
> It's more.  When using base+offset, the compiler will know nothing
> about the data type, so it canot warn you if you use a 32 bit accessor
> on a 8 bit register, or vice versa.  When you pass a struct element,
> it can check type information.

Is this really valid in our context? readl()/writel() and friends just
cast the address to the target type pointer. I tried writeb() on my 32
bit register represented using the struct approach and the compiler
didn't give any warning (as expected)!

best regards,
Aneesh


More information about the U-Boot mailing list