Commit 8030c36d13f030103356709e63638678fdc66fdc

Authored by H. Peter Anvin
1 parent da517a08ac

x86, atomic: atomic64_read() take a const pointer

atomic64_read() doesn't actually write anything (as far as the C
environment is concerned... the CPU does actually write but that's an
implementation quirk), so it should take a const pointer.

This does NOT mean that it is safe to use atomic64_read() on an object
in readonly storage (it will trap!)

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Link: http://lkml.kernel.org/r/20120109165859.1879abda.akpm@linux-foundation.org

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

arch/x86/include/asm/atomic64_32.h
... ... @@ -82,7 +82,7 @@
82 82 *
83 83 * Atomically reads the value of @v and returns it.
84 84 */
85   -static inline long long atomic64_read(atomic64_t *v)
  85 +static inline long long atomic64_read(const atomic64_t *v)
86 86 {
87 87 long long r;
88 88 asm volatile(ATOMIC64_ALTERNATIVE(read)