Skip to content

Commit 768da2e

Browse files
t-8chdkruces
authored andcommitted
kunit: test: Drop CONFIG_MODULE ifdeffery
The function stubs exposed by module.h allow the code to compile properly without the ifdeffery. The generated object code stays the same, as the compiler can optimize away all the dead code. As the code is still typechecked developer errors can be detected faster. Signed-off-by: Thomas Weißschuh <[email protected]> Acked-by: David Gow <[email protected]> Reviewed-by: Daniel Gomez <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Gomez <[email protected]>
1 parent 818783c commit 768da2e

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

lib/kunit/test.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,6 @@ void __kunit_test_suites_exit(struct kunit_suite **suites, int num_suites)
802802
}
803803
EXPORT_SYMBOL_GPL(__kunit_test_suites_exit);
804804

805-
#ifdef CONFIG_MODULES
806805
static void kunit_module_init(struct module *mod)
807806
{
808807
struct kunit_suite_set suite_set, filtered_set;
@@ -890,7 +889,6 @@ static struct notifier_block kunit_mod_nb = {
890889
.notifier_call = kunit_module_notify,
891890
.priority = 0,
892891
};
893-
#endif
894892

895893
KUNIT_DEFINE_ACTION_WRAPPER(kfree_action_wrapper, kfree, const void *)
896894

@@ -981,20 +979,14 @@ static int __init kunit_init(void)
981979
kunit_debugfs_init();
982980

983981
kunit_bus_init();
984-
#ifdef CONFIG_MODULES
985982
return register_module_notifier(&kunit_mod_nb);
986-
#else
987-
return 0;
988-
#endif
989983
}
990984
late_initcall(kunit_init);
991985

992986
static void __exit kunit_exit(void)
993987
{
994988
memset(&kunit_hooks, 0, sizeof(kunit_hooks));
995-
#ifdef CONFIG_MODULES
996989
unregister_module_notifier(&kunit_mod_nb);
997-
#endif
998990

999991
kunit_bus_shutdown();
1000992

0 commit comments

Comments
 (0)