[U-Boot] RFC: getramsize() prototype and volatile qualifier

Mike Frysinger vapier at gentoo.org
Thu Apr 21 19:02:11 CEST 2011


On Thu, Apr 21, 2011 at 3:09 AM, Albert ARIBAUD wrote:
> Call it a detail, but I see that get_ram_size() calls sometime qualify
> their argument as volatile and sometimes not, and this makes checkpatch
> complain that volatiles are Bad(tm), which I would like to get fixed.
>
> The prototype for get_ram_size() in is
>
>        long    get_ram_size  (volatile long *, long);
>
> While I understand that the way get_ram_size() works, it needs to
> perform volatile *accesses* to addresses computed from its arguments, I
> don't see why it requires one of the arguments themselves to be volatile.
>
> Am I missing something here, particularly about some toolchain requiring
> the argument to be volatile? I see no reason it should, but better safe
> than sorry.

the argument isnt volatile, the memory it points to is.  since
get_ram_size() itself doesnt dereference the argument (only goes
through a local "addr"), the volatile marking in the prototype could
be dropped, but personally i dont see the point.  the prototype doesnt
require callers to add volatile markings to their own code, and i
could see someone using "base" in the future after the volatile being
dropped and people not noticing right away.  the current code is safe
and causes no problems by itself, so i see no value in changing it.

this sounds like useless "gotta be checkpatch clean" work by people
blindly following its output.
-mike


More information about the U-Boot mailing list