Skip to content

Commit

Permalink
lib/test_bitops: do the full test during module init
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Cc: Wei Yang <[email protected]>
Cc: Jesse Brandeburg <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
geertu authored and torvalds committed Aug 12, 2020
1 parent 0a650e4 commit 403f177
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/test_bitops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 403f177

Please sign in to comment.