[patch 6/7 -rt] powerpc 2.6.20-rt8: fix compile error (percpu.h)

From: Tsutomu OWA
Date: Tue Mar 06 2007 - 20:21:16 EST



To fix the following compile error by adding necessary macro definitions
(mostly taken from asm-generic/percpu.h).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
include/asm-powerpc/percpu.h
In file included from include/asm/tlb.h:52,
from arch/powerpc/mm/mem.c:44:
include/asm-generic/tlb.h:49: error: expected declaration specifiers or '...' before 'mmu_gathers'
include/asm-generic/tlb.h:49: warning: data definition has no type or storage class
include/asm-generic/tlb.h:49: warning: type defaults to 'int' in declaration of 'DECLARE_PER_CPU_LOCKED'
include/asm-generic/tlb.h: In function 'tlb_gather_mmu':
include/asm-generic/tlb.h:58: warning: implicit declaration of function '__get_cpu_lock'
include/asm-generic/tlb.h:58: error: 'mmu_gathers' undeclared (first use in this function)
include/asm-generic/tlb.h:58: error: (Each undeclared identifier is reported only once
include/asm-generic/tlb.h:58: error: for each function it appears in.)
:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Signed-off-by: Tsutomu Owa <tsutomu.owa@xxxxxxxxxxxxx>
-- owa

diff -rup linux-rt8/include/asm-powerpc/percpu.h rt/include/asm-powerpc/percpu.h
--- linux-rt8/include/asm-powerpc/percpu.h 2007-02-20 09:37:27.000000000 +0900
+++ rt/include/asm-powerpc/percpu.h 2007-02-20 16:03:44.000000000 +0900
@@ -19,12 +19,24 @@
/* Separate out the type, so (int[3], foo) works. */
#define DEFINE_PER_CPU(type, name) \
__attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
+#define DEFINE_PER_CPU_LOCKED(type, name) \
+ __attribute__((__section__(".data.percpu"))) __DEFINE_SPINLOCK(per_cpu_lock__##name##_locked); \
+ __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name##_locked

/* var is in discarded region: offset to particular copy we want */
#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))

+#define per_cpu_lock(var, cpu) \
+ (*RELOC_HIDE(&per_cpu_lock__##var##_locked, __per_cpu_offset(cpu)))
+#define per_cpu_var_locked(var, cpu) \
+ (*RELOC_HIDE(&per_cpu__##var##_locked, __per_cpu_offset(cpu)))
+#define __get_cpu_lock(var, cpu) \
+ per_cpu_lock(var, cpu)
+#define __get_cpu_var_locked(var, cpu) \
+ per_cpu_var_locked(var, cpu)
+
/* A macro to avoid #include hell... */
#define percpu_modcopy(pcpudst, src, size) \
do { \
@@ -40,17 +52,27 @@ extern void setup_per_cpu_areas(void);

#define DEFINE_PER_CPU(type, name) \
__typeof__(type) per_cpu__##name
+#define DEFINE_PER_CPU_LOCKED(type, name) \
+ __DEFINE_SPINLOCK(per_cpu_lock__##name##_locked); \
+ __typeof__(type) per_cpu__##name##_locked

#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
+#define per_cpu_var_locked(var, cpu) (*((void)(cpu), &per_cpu__##var##_locked))
+
#define __get_cpu_var(var) per_cpu__##var
#define __raw_get_cpu_var(var) per_cpu__##var

#endif /* SMP */

#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
+#define DECLARE_PER_CPU_LOCKED(type, name) \
+ extern spinlock_t per_cpu_lock__##name##_locked; \
+ extern __typeof__(type) per_cpu__##name##_locked

#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
+#define EXPORT_PER_CPU_LOCKED_SYMBOL(var) EXPORT_SYMBOL(per_cpu_lock__##var##_locked); EXPORT_SYMBOL(per_cpu__##var##_locked)
+#define EXPORT_PER_CPU_LOCKED_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu_lock__##var##_locked); EXPORT_SYMBOL_GPL(per_cpu__##var##_locked)

#else
#include <asm-generic/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/