lkml.org 
[lkml]   [2009]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] unbreak alpha percpu
asm-generic/percpu.h is *NOT* included by every asm/percpu.h out there.
Namely, alpha can't use it since it needs the var name in
SHIFT_PERCPU_PTR - &per_cpu_var(var) won't do at all. So adding stuff
to asm-generic/percpu.h and expecting it to be picked by everything
is not going to work.

Frankly, I'd rather have SHIFT_PERCPU_PTR() calling conventions changed,
but for now the patch below will do.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/arch/alpha/include/asm/percpu.h b/arch/alpha/include/asm/percpu.h
index 3495e8e..fffec74 100644
--- a/arch/alpha/include/asm/percpu.h
+++ b/arch/alpha/include/asm/percpu.h
@@ -75,4 +75,30 @@ extern unsigned long __per_cpu_offset[NR_CPUS];

#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu_var(name)

+# define percpu_read(var) \
+ ({ \
+ typeof(per_cpu_var(var)) __tmp_var__; \
+ __tmp_var__ = get_cpu_var(var); \
+ put_cpu_var(var); \
+ __tmp_var__; \
+ })
+
+#define __percpu_generic_to_op(var, val, op) \
+do { \
+ get_cpu_var(var) op val; \
+ put_cpu_var(var); \
+} while (0)
+
+# define percpu_write(var, val) __percpu_generic_to_op(var, (val), =)
+
+# define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=)
+
+# define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=)
+
+# define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=)
+
+# define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=)
+
+# define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=)
+
#endif /* __ALPHA_PERCPU_H */

\
 
 \ /
  Last update: 2009-04-10 17:15    [W:0.071 / U:0.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site