提交 7463449b 编写于 作者: C Catalin Marinas 提交者: Linus Torvalds

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: NCatalin 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: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 6017b485
...@@ -11,6 +11,7 @@ config ARM ...@@ -11,6 +11,7 @@ config ARM
select RTC_LIB select RTC_LIB
select SYS_SUPPORTS_APM_EMULATION select SYS_SUPPORTS_APM_EMULATION
select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI)
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select HAVE_OPROFILE if (HAVE_PERF_EVENTS) select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
select HAVE_ARCH_KGDB select HAVE_ARCH_KGDB
......
...@@ -20,6 +20,7 @@ config MIPS ...@@ -20,6 +20,7 @@ config MIPS
select ARCH_BINFMT_ELF_RANDOMIZE_PIE select ARCH_BINFMT_ELF_RANDOMIZE_PIE
select RTC_LIB if !MACH_LOONGSON select RTC_LIB if !MACH_LOONGSON
select GENERIC_ATOMIC64 if !64BIT select GENERIC_ATOMIC64 if !64BIT
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select HAVE_DMA_ATTRS select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG select HAVE_DMA_API_DEBUG
select HAVE_GENERIC_HARDIRQS select HAVE_GENERIC_HARDIRQS
......
...@@ -115,6 +115,7 @@ config PPC ...@@ -115,6 +115,7 @@ config PPC
select HAVE_OPROFILE select HAVE_OPROFILE
select HAVE_SYSCALL_WRAPPERS if PPC64 select HAVE_SYSCALL_WRAPPERS if PPC64
select GENERIC_ATOMIC64 if PPC32 select GENERIC_ATOMIC64 if PPC32
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select HAVE_IRQ_WORK select HAVE_IRQ_WORK
select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS
select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_REGS_AND_STACK_ACCESS_API
......
...@@ -85,6 +85,7 @@ config S390 ...@@ -85,6 +85,7 @@ config S390
select HAVE_ARCH_MUTEX_CPU_RELAX select HAVE_ARCH_MUTEX_CPU_RELAX
select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
select ARCH_SAVE_PAGE_KEYS if HIBERNATION select ARCH_SAVE_PAGE_KEYS if HIBERNATION
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select HAVE_MEMBLOCK select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP select HAVE_MEMBLOCK_NODE_MAP
select HAVE_CMPXCHG_LOCAL select HAVE_CMPXCHG_LOCAL
......
...@@ -70,6 +70,7 @@ config X86 ...@@ -70,6 +70,7 @@ config X86
select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_JUMP_LABEL
select HAVE_TEXT_POKE_SMP select HAVE_TEXT_POKE_SMP
select HAVE_GENERIC_HARDIRQS select HAVE_GENERIC_HARDIRQS
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select SPARSE_IRQ select SPARSE_IRQ
select GENERIC_FIND_FIRST_BIT select GENERIC_FIND_FIRST_BIT
select GENERIC_IRQ_PROBE select GENERIC_IRQ_PROBE
......
...@@ -340,6 +340,9 @@ config NLATTR ...@@ -340,6 +340,9 @@ config NLATTR
config GENERIC_ATOMIC64 config GENERIC_ATOMIC64
bool bool
config ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
def_bool y if GENERIC_ATOMIC64
config LRU_CACHE config LRU_CACHE
tristate tristate
......
...@@ -114,8 +114,7 @@ static __init int test_atomic64(void) ...@@ -114,8 +114,7 @@ static __init int test_atomic64(void)
r += one; r += one;
BUG_ON(v.counter != r); BUG_ON(v.counter != r);
#if defined(CONFIG_X86) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ #ifdef CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
defined(CONFIG_S390) || defined(_ASM_GENERIC_ATOMIC64_H) || defined(CONFIG_ARM)
INIT(onestwos); INIT(onestwos);
BUG_ON(atomic64_dec_if_positive(&v) != (onestwos - 1)); BUG_ON(atomic64_dec_if_positive(&v) != (onestwos - 1));
r -= one; r -= one;
...@@ -129,7 +128,7 @@ static __init int test_atomic64(void) ...@@ -129,7 +128,7 @@ static __init int test_atomic64(void)
BUG_ON(atomic64_dec_if_positive(&v) != (-one - one)); BUG_ON(atomic64_dec_if_positive(&v) != (-one - one));
BUG_ON(v.counter != r); BUG_ON(v.counter != r);
#else #else
#warning Please implement atomic64_dec_if_positive for your architecture, and add it to the IF above #warning Please implement atomic64_dec_if_positive for your architecture and select the above Kconfig symbol
#endif #endif
INIT(onestwos); INIT(onestwos);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册