public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] unbreak alpha percpu
@ 2009-04-10 15:12 Al Viro
  2009-04-10 15:47 ` Al Viro
  0 siblings, 1 reply; 15+ messages in thread
From: Al Viro @ 2009-04-10 15:12 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

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

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-04-16 10:22 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-10 15:12 [PATCH] unbreak alpha percpu Al Viro
2009-04-10 15:47 ` Al Viro
2009-04-10 16:21   ` Linus Torvalds
2009-04-10 16:50     ` Al Viro
2009-04-10 17:05       ` Al Viro
2009-04-10 17:14         ` Al Viro
2009-04-10 18:05           ` Ivan Kokshaysky
2009-04-10 18:20             ` Linus Torvalds
2009-04-10 18:43               ` Tejun Heo
2009-04-10 19:02                 ` Tejun Heo
2009-04-10 19:34                   ` Ingo Molnar
2009-04-10 19:40                     ` [GIT PULL] percpu + mutex fixes Ingo Molnar
2009-04-16 10:21                       ` Al Viro
2009-04-14  7:45     ` [PATCH] unbreak alpha percpu Martin Schwidefsky
2009-04-14  9:01       ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox