aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2012-07-30 17:41:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 20:25:16 -0400
commit7463449b8287162454d7e00bf7fd2c64f72c1dc8 (patch)
treec9dd3007ce4cd59489c0cb7b55b0240aa8bbd865
parent6017b485caeae5915956190b4f3d8307021e785d (diff)
atomic64_test: simplify the #ifdef for atomic64_dec_if_positive() test
Introduce CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE and use this instead of the multitude of #if defined() checks in atomic64_test.c Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--lib/Kconfig3
-rw-r--r--lib/atomic64_test.c5
7 files changed, 10 insertions, 3 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fbdd8533c05d..4172c3cea228 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -11,6 +11,7 @@ config ARM
11 select RTC_LIB 11 select RTC_LIB
12 select SYS_SUPPORTS_APM_EMULATION 12 select SYS_SUPPORTS_APM_EMULATION
13 select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) 13 select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI)
14 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
14 select HAVE_OPROFILE if (HAVE_PERF_EVENTS) 15 select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
15 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 16 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
16 select HAVE_ARCH_KGDB 17 select HAVE_ARCH_KGDB
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b3e10fdd3898..5e238d03960d 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -20,6 +20,7 @@ config MIPS
20 select ARCH_BINFMT_ELF_RANDOMIZE_PIE 20 select ARCH_BINFMT_ELF_RANDOMIZE_PIE
21 select RTC_LIB if !MACH_LOONGSON 21 select RTC_LIB if !MACH_LOONGSON
22 select GENERIC_ATOMIC64 if !64BIT 22 select GENERIC_ATOMIC64 if !64BIT
23 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
23 select HAVE_DMA_ATTRS 24 select HAVE_DMA_ATTRS
24 select HAVE_DMA_API_DEBUG 25 select HAVE_DMA_API_DEBUG
25 select HAVE_GENERIC_HARDIRQS 26 select HAVE_GENERIC_HARDIRQS
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 9a5d3cdc3e12..4f681b78dd8b 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -115,6 +115,7 @@ config PPC
115 select HAVE_OPROFILE 115 select HAVE_OPROFILE
116 select HAVE_SYSCALL_WRAPPERS if PPC64 116 select HAVE_SYSCALL_WRAPPERS if PPC64
117 select GENERIC_ATOMIC64 if PPC32 117 select GENERIC_ATOMIC64 if PPC32
118 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
118 select HAVE_IRQ_WORK 119 select HAVE_IRQ_WORK
119 select HAVE_PERF_EVENTS 120 select HAVE_PERF_EVENTS
120 select HAVE_REGS_AND_STACK_ACCESS_API 121 select HAVE_REGS_AND_STACK_ACCESS_API
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index a39b4690c171..d0a5e92b6b9e 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -85,6 +85,7 @@ config S390
85 select HAVE_ARCH_MUTEX_CPU_RELAX 85 select HAVE_ARCH_MUTEX_CPU_RELAX
86 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 86 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
87 select ARCH_SAVE_PAGE_KEYS if HIBERNATION 87 select ARCH_SAVE_PAGE_KEYS if HIBERNATION
88 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
88 select HAVE_MEMBLOCK 89 select HAVE_MEMBLOCK
89 select HAVE_MEMBLOCK_NODE_MAP 90 select HAVE_MEMBLOCK_NODE_MAP
90 select HAVE_CMPXCHG_LOCAL 91 select HAVE_CMPXCHG_LOCAL
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c70684f859e1..ca4fdefe79e6 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -70,6 +70,7 @@ config X86
70 select HAVE_ARCH_JUMP_LABEL 70 select HAVE_ARCH_JUMP_LABEL
71 select HAVE_TEXT_POKE_SMP 71 select HAVE_TEXT_POKE_SMP
72 select HAVE_GENERIC_HARDIRQS 72 select HAVE_GENERIC_HARDIRQS
73 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
73 select SPARSE_IRQ 74 select SPARSE_IRQ
74 select GENERIC_FIND_FIRST_BIT 75 select GENERIC_FIND_FIRST_BIT
75 select GENERIC_IRQ_PROBE 76 select GENERIC_IRQ_PROBE
diff --git a/lib/Kconfig b/lib/Kconfig
index 8269d56dcdaa..72c1d4693068 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -340,6 +340,9 @@ config NLATTR
340config GENERIC_ATOMIC64 340config GENERIC_ATOMIC64
341 bool 341 bool
342 342
343config ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
344 def_bool y if GENERIC_ATOMIC64
345
343config LRU_CACHE 346config LRU_CACHE
344 tristate 347 tristate
345 348
diff --git a/lib/atomic64_test.c b/lib/atomic64_test.c
index cb99b91c3a1d..00bca223d1e1 100644
--- a/lib/atomic64_test.c
+++ b/lib/atomic64_test.c
@@ -114,8 +114,7 @@ static __init int test_atomic64(void)
114 r += one; 114 r += one;
115 BUG_ON(v.counter != r); 115 BUG_ON(v.counter != r);
116 116
117#if defined(CONFIG_X86) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ 117#ifdef CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
118 defined(CONFIG_S390) || defined(_ASM_GENERIC_ATOMIC64_H) || defined(CONFIG_ARM)
119 INIT(onestwos); 118 INIT(onestwos);
120 BUG_ON(atomic64_dec_if_positive(&v) != (onestwos - 1)); 119 BUG_ON(atomic64_dec_if_positive(&v) != (onestwos - 1));
121 r -= one; 120 r -= one;
@@ -129,7 +128,7 @@ static __init int test_atomic64(void)
129 BUG_ON(atomic64_dec_if_positive(&v) != (-one - one)); 128 BUG_ON(atomic64_dec_if_positive(&v) != (-one - one));
130 BUG_ON(v.counter != r); 129 BUG_ON(v.counter != r);
131#else 130#else
132#warning Please implement atomic64_dec_if_positive for your architecture, and add it to the IF above 131#warning Please implement atomic64_dec_if_positive for your architecture and select the above Kconfig symbol
133#endif 132#endif
134 133
135 INIT(onestwos); 134 INIT(onestwos);