From: H. Peter Anvin Date: Tue, 10 Jan 2012 03:33:24 +0000 (-0800) Subject: x86, atomic: atomic64_read() take a const pointer X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8030c36d13f030103356709e63638678fdc66fdc;p=linux-beck.git 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 Signed-off-by: H. Peter Anvin Link: http://lkml.kernel.org/r/20120109165859.1879abda.akpm@linux-foundation.org --- diff --git a/arch/x86/include/asm/atomic64_32.h b/arch/x86/include/asm/atomic64_32.h index 24098aafce0d..fa13f0ec2874 100644 --- a/arch/x86/include/asm/atomic64_32.h +++ b/arch/x86/include/asm/atomic64_32.h @@ -82,7 +82,7 @@ static inline void atomic64_set(atomic64_t *v, long long i) * * Atomically reads the value of @v and returns it. */ -static inline long long atomic64_read(atomic64_t *v) +static inline long long atomic64_read(const atomic64_t *v) { long long r; asm volatile(ATOMIC64_ALTERNATIVE(read)