lib/vsprintf: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols
Subsystems (2)
Andy Shevchenko
reviewerPATCH 1/1 lib/vsprintf: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols
Replace EXPORT_SYMBOL_FOR_MODULES() with EXPORT_SYMBOL_IF_KUNIT() to mark the symbols as visible only if CONFIG_KUNIT is enabled.
Kunit test should import the namespace EXPORTED_FOR_KUNIT_TESTING to use these marked symbols. This is the standard way for all KUnit tests.
--- lib/tests/printf_kunit.c | 1 + lib/vsprintf.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-)
lib/tests/printf_kunit.c +1 -0
@@ -876,3 +876,4 @@ kunit_test_suite(printf_test_suite);MODULE_AUTHOR ("Rasmus Villemoes <[email protected]>" );MODULE_DESCRIPTION ("Test cases for printf facility" );MODULE_LICENSE ("GPL" ); +MODULE_IMPORT_NS ("EXPORTED_FOR_KUNIT_TESTING" );
lib/vsprintf.c +5 -3
@@ -25,6 +25,7 @@#include <linux/module.h> /* for KSYM_SYMBOL_LEN */ #include <linux/types.h> #include <linux/string.h> +#include <linux/string_helpers.h> #include <linux/ctype.h> #include <linux/hex.h> #include <linux/kernel.h>
@@ -54,12 +55,13 @@#include <asm/byteorder.h> /* cpu_to_le16 */ #include <linux/unaligned.h> -#include <linux/string_helpers.h> +#include <kunit/visibility.h> +#include "kstrtox.h" /* Disable pointer hashing if requested */ bool no_hash_pointers__ro_after_init ; -EXPORT_SYMBOL_FOR_MODULES (no_hash_pointers,"printf_kunit" ); +EXPORT_SYMBOL_IF_KUNIT (no_hash_pointers);/* * Hashed pointers policy selected by "hash_pointers=..." boot param
@@ -850,7 +852,7 @@ static char *default_pointer(char *buf, char *end, const void *ptr, }int kptr_restrict__read_mostly ; -EXPORT_SYMBOL_FOR_MODULES (kptr_restrict,"printf_kunit" ); +EXPORT_SYMBOL_IF_KUNIT (kptr_restrict);static noinline_for_stack char *restricted_pointer(char *buf, char *end, const void *ptr,
Signature · 1 line
2.50.1
Quoted 9 lines · Andy Shevchenko
Replace
EXPORT_SYMBOL_FOR_MODULES()withEXPORT_SYMBOL_IF_KUNIT()to mark the symbols as visible only ifCONFIG_KUNITis enabled.Kunit test should import the namespace
EXPORTED_FOR_KUNIT_TESTINGto use these marked symbols. This is the standard way for all KUnit tests.Signed-off-by Andy Shevchenko <[email protected]>
Andy Shevchenko
reviewerQuoted 6 lines · Tamir Duberstein
Quoted 4 lines · Andy Shevchenko
Replace
EXPORT_SYMBOL_FOR_MODULES()withEXPORT_SYMBOL_IF_KUNIT()to mark the symbols as visible only ifCONFIG_KUNITis enabled.
Quoted 7 lines
Quoted 5 lines
Kunit test should import the namespace
EXPORTED_FOR_KUNIT_TESTINGto use these marked symbols. This is the standard way for all KUnit tests.Signed-off-by Andy Shevchenko <[email protected]>Acked-by Tamir Duberstein <[email protected]>
Thanks!
Petr, does this fall in cracks? Can it be applied or do you have any comments on this? Or may be I missed something?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Petr Mladek
maintainerQuoted 11 lines · Andy Shevchenko
Quoted 10 lines · Tamir Duberstein
Quoted 8 lines · Andy Shevchenko
Replace
EXPORT_SYMBOL_FOR_MODULES()withEXPORT_SYMBOL_IF_KUNIT()to mark the symbols as visible only ifCONFIG_KUNITis enabled.Kunit test should import the namespace
EXPORTED_FOR_KUNIT_TESTINGto use these marked symbols. This is the standard way for all KUnit tests.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Andy Shevchenko <[email protected]>Acked-by Tamir Duberstein <[email protected]>Thanks!
Petr, does this fall in cracks? Can it be applied or do you have any comments on this? Or may be I missed something?
Yeah, this has fallen through the cracks. /o\
I have just committed it into printk/linux.git, branch for-7.4.
Thanks a lot for reminder.
Best Regards,
Petr