summaryrefslogtreecommitdiff
path: root/lib/test_sysctl.c
diff options
context:
space:
mode:
authorJoel Granados <j.granados@samsung.com>2023-06-16 10:59:17 +0200
committerLuis Chamberlain <mcgrof@kernel.org>2023-06-18 02:32:53 -0700
commite009bd5efe81c5ccd2c08626a79c37d2a238ff15 (patch)
treedbf90dc4e6cfbb743019d857e3d2d3605a2de05a /lib/test_sysctl.c
parenta40b702789a480904b15f5843c4ed79f969ee4d5 (diff)
test_sysctl: Group node sysctl test under one func
Preparation commit to add a new type of test to test_sysctl.c. We want to differentiate between node and (sub)directory tests. Signed-off-by: Joel Granados <j.granados@samsung.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'lib/test_sysctl.c')
-rw-r--r--lib/test_sysctl.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c
index e2a816d85ea2..0cf7c547d61a 100644
--- a/lib/test_sysctl.c
+++ b/lib/test_sysctl.c
@@ -126,9 +126,7 @@ static struct ctl_table test_table[] = {
{ }
};
-static struct ctl_table_header *test_sysctl_header;
-
-static int __init test_sysctl_init(void)
+static void test_sysctl_calc_match_int_ok(void)
{
int i;
@@ -153,7 +151,13 @@ static int __init test_sysctl_init(void)
for (i = 0; i < ARRAY_SIZE(match_int); i++)
if (match_int[i].defined != match_int[i].wanted)
match_int_ok = 0;
+}
+static struct ctl_table_header *test_sysctl_header;
+
+static int test_sysctl_setup_node_tests(void)
+{
+ test_sysctl_calc_match_int_ok();
test_data.bitmap_0001 = kzalloc(SYSCTL_TEST_BITMAP_SIZE/8, GFP_KERNEL);
if (!test_data.bitmap_0001)
return -ENOMEM;
@@ -162,8 +166,18 @@ static int __init test_sysctl_init(void)
kfree(test_data.bitmap_0001);
return -ENOMEM;
}
+
return 0;
}
+
+static int __init test_sysctl_init(void)
+{
+ int err;
+
+ err = test_sysctl_setup_node_tests();
+
+ return err;
+}
module_init(test_sysctl_init);
static void __exit test_sysctl_exit(void)