Note that "volatile"is a type-qualifier, not a type itself, so a cast of the _object_ itself to a qualified-type i.e. (volatile int) would not make the access itselfvolatile-qualified.
There is no such thing as "volatile-qualified access" defined anywhere; there only is the concept of a "volatile-qualified *object*".
To serve our purposes, it is necessary for us to take the address of this (non-volatile) object, cast the resulting _pointer_ to the corresponding volatile-qualified pointer-type, and then dereference it. This makes that particular _access_ be volatile-qualified, without the object itself being such. Also note that the (dereferenced) result is also a valid lvalue andhence can be used in "*(volatile int *)&a = b;" kind of construction (which we use for the atomic_set case).
There is a quite convincing argument that such an access _is_ an access to a volatile object; see GCC PR21568 comment #9. This probably isn't the last word on the matter though... Segher - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
- From: Satyam Sharma <[email protected]>
- RE: [PATCH 0/24] make atomic_read() behave consistently across all architectures
- From: "David Schwartz" <[email protected]>
- Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
- References:
- [PATCH 0/24] make atomic_read() behave consistently across all architectures
- From: Chris Snook <[email protected]>
- Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
- From: Christoph Lameter <[email protected]>
- Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
- From: Satyam Sharma <[email protected]>
- Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
- From: Stefan Richter <[email protected]>
- Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
- From: Satyam Sharma <[email protected]>
- Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
- From: Bill Fink <[email protected]>
- Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
- From: Satyam Sharma <[email protected]>
- [PATCH 0/24] make atomic_read() behave consistently across all architectures
- Prev by Date: RFHelp: Splitting MAINTAINERS into maintainers/* and Makefile/Kconfig support
- Next by Date: Re:[Spam] Re: [PATCH] UML - Add a .note.SuSE section
- Previous by thread: Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
- Next by thread: RE: [PATCH 0/24] make atomic_read() behave consistently across all architectures
- Index(es):