mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Petr Mladek <pmladek@suse.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Tamir Duberstein <tamird@kernel.org>,
	linux-kernel@vger.kernel.org
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH v1 1/1] lib/vsprintf: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols
Date: Tue, 14 Jul 2026 14:21:43 +0200	[thread overview]
Message-ID: <20260714122143.743227-1-andriy.shevchenko@linux.intel.com> (raw)

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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 lib/tests/printf_kunit.c | 1 +
 lib/vsprintf.c           | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c
index eccf041ebd56..290d59b22c29 100644
--- a/lib/tests/printf_kunit.c
+++ b/lib/tests/printf_kunit.c
@@ -876,3 +876,4 @@ kunit_test_suite(printf_test_suite);
 MODULE_AUTHOR("Rasmus Villemoes <linux@rasmusvillemoes.dk>");
 MODULE_DESCRIPTION("Test cases for printf facility");
 MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 1d95ab9314bf..83d22c53a81d 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -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,
-- 
2.50.1


             reply	other threads:[~2026-07-14 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14 12:21 Andy Shevchenko [this message]
2026-07-14 14:39 ` Tamir Duberstein
2026-10-13 20:41   ` Andy Shevchenko
2026-10-14  9:34     ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260714122143.743227-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=tamird@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®