[U-Boot] [PATCH v3] ARM: Avoid compiler optimization for usages of readb, writeb and friends.

Wolfgang Denk wd at denx.de
Mon Jan 17 22:59:37 CET 2011


Dear Dirk Behme,

In message <4D2B3036.4010506 at googlemail.com> you wrote:
> 
> The question I was thinking about with my patch was "what's Right 
> Thing?" ;)

The Right Thing i not to make specific assumptions how the compiler
might handle volatile pointers.

> It's my understanding that we don't fix read*() and write*() because 
> they are broken. We touch them to work around a broken tool chain.

No. Please re-read volatile-considered-harmful.txt in the
linux/Documentation directory: "accessing I/O memory directly through
pointers is frowned upon and does not work on all architectures.
Those accessors are written to prevent unwanted optimization".

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
It is dangerous to be sincere unless you are also stupid.
                                                - George Bernard Shaw


More information about the U-Boot mailing list