]> git.dujemihanovic.xyz Git - linux.git/commitdiff
lib/test_bitops: do the full test during module init
authorGeert Uytterhoeven <geert@linux-m68k.org>
Wed, 12 Aug 2020 01:34:38 +0000 (18:34 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 12 Aug 2020 17:57:59 +0000 (10:57 -0700)
Currently, the bitops test consists of two parts: one part is executed
during module load, the second part during module unload.  This is
cumbersome for the user, as he has to perform two steps to execute all
tests, and is different from most (all?) other tests.

Merge the two parts, so both are executed during module load.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Link: http://lkml.kernel.org/r/20200706112900.7097-1-geert@linux-m68k.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/test_bitops.c

index ced25e3a779baf9608bf114e61fe0c0fc728676c..471141ddd69137246aa2aefec271eb2ef70c072f 100644 (file)
@@ -52,9 +52,9 @@ static unsigned long order_comb_long[][2] = {
 
 static int __init test_bitops_startup(void)
 {
-       int i;
+       int i, bit_set;
 
-       pr_warn("Loaded test module\n");
+       pr_info("Starting bitops test\n");
        set_bit(BITOPS_4, g_bitmap);
        set_bit(BITOPS_7, g_bitmap);
        set_bit(BITOPS_11, g_bitmap);
@@ -81,12 +81,8 @@ static int __init test_bitops_startup(void)
                                       order_comb_long[i][0]);
        }
 #endif
-       return 0;
-}
 
-static void __exit test_bitops_unstartup(void)
-{
-       int bit_set;
+       barrier();
 
        clear_bit(BITOPS_4, g_bitmap);
        clear_bit(BITOPS_7, g_bitmap);
@@ -98,7 +94,13 @@ static void __exit test_bitops_unstartup(void)
        if (bit_set != BITOPS_LAST)
                pr_err("ERROR: FOUND SET BIT %d\n", bit_set);
 
-       pr_warn("Unloaded test module\n");
+       pr_info("Completed bitops test\n");
+
+       return 0;
+}
+
+static void __exit test_bitops_unstartup(void)
+{
 }
 
 module_init(test_bitops_startup);