[PATCH] unbreak alpha percpu

From: Al Viro
Date: Fri Apr 10 2009 - 11:12:36 EST


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@xxxxxxxxxxxxxxxxxx>
---
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 */
--
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/