[PATCH] x86, percpu: Fix __this_cpu_ptr with const pointers

From: Brian Gerst
Date: Fri Sep 10 2010 - 01:31:28 EST


Fix this error when the pointer is marked const:
error: read-only variable 'tcp_ptr__' used as 'asm' output

Signed-off-by: Brian Gerst <brgerst@xxxxxxxxx>
CC: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
---
arch/x86/include/asm/percpu.h | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index fe418dd..f62b52c 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -54,12 +54,12 @@
*/
#define __this_cpu_ptr(ptr) \
({ \
- typeof(ptr) tcp_ptr__ = (ptr); \
+ unsigned long tcp_ptr__; \
__verify_pcpu_ptr(ptr); \
asm volatile("add " __percpu_arg(1) ", %0" \
- : "+r" (tcp_ptr__) \
- : "m" (this_cpu_off)); \
- tcp_ptr__; \
+ : "=r" (tcp_ptr__) \
+ : "m" (this_cpu_off), "0" (ptr)); \
+ (typeof(ptr) __kernel __force) tcp_ptr__; \
})
#else
#define __percpu_arg(x) "%P" #x
--
1.7.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/