Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Catalin Marinas and committed by
Linus Torvalds
7463449b 6017b485

+10 -3
+1
arch/arm/Kconfig
··· 11 11 select RTC_LIB 12 12 select SYS_SUPPORTS_APM_EMULATION 13 13 select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) 14 + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 14 15 select HAVE_OPROFILE if (HAVE_PERF_EVENTS) 15 16 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 16 17 select HAVE_ARCH_KGDB
+1
arch/mips/Kconfig
··· 20 20 select ARCH_BINFMT_ELF_RANDOMIZE_PIE 21 21 select RTC_LIB if !MACH_LOONGSON 22 22 select GENERIC_ATOMIC64 if !64BIT 23 + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 23 24 select HAVE_DMA_ATTRS 24 25 select HAVE_DMA_API_DEBUG 25 26 select HAVE_GENERIC_HARDIRQS
+1
arch/powerpc/Kconfig
··· 115 115 select HAVE_OPROFILE 116 116 select HAVE_SYSCALL_WRAPPERS if PPC64 117 117 select GENERIC_ATOMIC64 if PPC32 118 + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 118 119 select HAVE_IRQ_WORK 119 120 select HAVE_PERF_EVENTS 120 121 select HAVE_REGS_AND_STACK_ACCESS_API
+1
arch/s390/Kconfig
··· 85 85 select HAVE_ARCH_MUTEX_CPU_RELAX 86 86 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 87 87 select ARCH_SAVE_PAGE_KEYS if HIBERNATION 88 + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 88 89 select HAVE_MEMBLOCK 89 90 select HAVE_MEMBLOCK_NODE_MAP 90 91 select HAVE_CMPXCHG_LOCAL
+1
arch/x86/Kconfig
··· 70 70 select HAVE_ARCH_JUMP_LABEL 71 71 select HAVE_TEXT_POKE_SMP 72 72 select HAVE_GENERIC_HARDIRQS 73 + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 73 74 select SPARSE_IRQ 74 75 select GENERIC_FIND_FIRST_BIT 75 76 select GENERIC_IRQ_PROBE
+3
lib/Kconfig
··· 340 340 config GENERIC_ATOMIC64 341 341 bool 342 342 343 + config ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 344 + def_bool y if GENERIC_ATOMIC64 345 + 343 346 config LRU_CACHE 344 347 tristate 345 348
+2 -3
lib/atomic64_test.c
··· 114 114 r += one; 115 115 BUG_ON(v.counter != r); 116 116 117 - #if defined(CONFIG_X86) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ 118 - defined(CONFIG_S390) || defined(_ASM_GENERIC_ATOMIC64_H) || defined(CONFIG_ARM) 117 + #ifdef CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 119 118 INIT(onestwos); 120 119 BUG_ON(atomic64_dec_if_positive(&v) != (onestwos - 1)); 121 120 r -= one; ··· 128 129 BUG_ON(atomic64_dec_if_positive(&v) != (-one - one)); 129 130 BUG_ON(v.counter != r); 130 131 #else 131 - #warning Please implement atomic64_dec_if_positive for your architecture, and add it to the IF above 132 + #warning Please implement atomic64_dec_if_positive for your architecture and select the above Kconfig symbol 132 133 #endif 133 134 134 135 INIT(onestwos);