]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
lib: add module support to atomic64 tests
authorGeert Uytterhoeven <geert@linux-m68k.org>
Fri, 24 Feb 2017 23:00:55 +0000 (15:00 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 25 Feb 2017 01:46:57 +0000 (17:46 -0800)
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>
lib/Kconfig.debug
lib/atomic64_test.c

index 66fb4389f05c96959cf8b8f226964e4a3a5bcaf7..213decb76922fbde2852307314ee7de933b0b203 100644 (file)
@@ -1790,9 +1790,10 @@ config PERCPU_TEST
          If unsure, say N.
 
 config ATOMIC64_SELFTEST
-       bool "Perform an atomic64_t self-test at boot"
+       tristate "Perform an atomic64_t self-test"
        help
-         Enable this option to test the atomic64_t functions at boot.
+         Enable this option to test the atomic64_t functions at boot or
+         at module load time.
 
          If unsure, say N.
 
index 46042901130f107b4b943487337cca4b764b50f6..fd70c0e0e67314999fcab5c69c9c06dcec527c03 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/bug.h>
 #include <linux/kernel.h>
 #include <linux/atomic.h>
+#include <linux/module.h>
 
 #ifdef CONFIG_X86
 #include <asm/cpufeature.h>    /* for boot_cpu_has below */
@@ -241,7 +242,7 @@ static __init void test_atomic64(void)
        BUG_ON(v.counter != r);
 }
 
-static __init int test_atomics(void)
+static __init int test_atomics_init(void)
 {
        test_atomic();
        test_atomic64();
@@ -264,4 +265,9 @@ static __init int test_atomics(void)
        return 0;
 }
 
-core_initcall(test_atomics);
+static __exit void test_atomics_exit(void) {}
+
+module_init(test_atomics_init);
+module_exit(test_atomics_exit);
+
+MODULE_LICENSE("GPL");