aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2017-02-24 18:00:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-24 20:46:57 -0500
commit55ded9551f9a64f2872df77a954d4c30f8958e82 (patch)
tree89d6c2ee51563b93a3d54bf50413c5ba89dd1db9
parentba95b045e94fe15cace3a7d3a20fbedb2c6a817e (diff)
lib: add module support to atomic64 tests
Allow to compile the atomic64 test code either to a loadable module, or builtin into the kernel. Link: http://lkml.kernel.org/r/1483470276-10517-3-git-send-email-geert@linux-m68k.org Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--lib/Kconfig.debug5
-rw-r--r--lib/atomic64_test.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 66fb4389f05c..213decb76922 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1790,9 +1790,10 @@ config PERCPU_TEST
1790 If unsure, say N. 1790 If unsure, say N.
1791 1791
1792config ATOMIC64_SELFTEST 1792config ATOMIC64_SELFTEST
1793 bool "Perform an atomic64_t self-test at boot" 1793 tristate "Perform an atomic64_t self-test"
1794 help 1794 help
1795 Enable this option to test the atomic64_t functions at boot. 1795 Enable this option to test the atomic64_t functions at boot or
1796 at module load time.
1796 1797
1797 If unsure, say N. 1798 If unsure, say N.
1798 1799
diff --git a/lib/atomic64_test.c b/lib/atomic64_test.c
index 46042901130f..fd70c0e0e673 100644
--- a/lib/atomic64_test.c
+++ b/lib/atomic64_test.c
@@ -15,6 +15,7 @@
15#include <linux/bug.h> 15#include <linux/bug.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/atomic.h> 17#include <linux/atomic.h>
18#include <linux/module.h>
18 19
19#ifdef CONFIG_X86 20#ifdef CONFIG_X86
20#include <asm/cpufeature.h> /* for boot_cpu_has below */ 21#include <asm/cpufeature.h> /* for boot_cpu_has below */
@@ -241,7 +242,7 @@ static __init void test_atomic64(void)
241 BUG_ON(v.counter != r); 242 BUG_ON(v.counter != r);
242} 243}
243 244
244static __init int test_atomics(void) 245static __init int test_atomics_init(void)
245{ 246{
246 test_atomic(); 247 test_atomic();
247 test_atomic64(); 248 test_atomic64();
@@ -264,4 +265,9 @@ static __init int test_atomics(void)
264 return 0; 265 return 0;
265} 266}
266 267
267core_initcall(test_atomics); 268static __exit void test_atomics_exit(void) {}
269
270module_init(test_atomics_init);
271module_exit(test_atomics_exit);
272
273MODULE_LICENSE("GPL");