From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B3B743F8CE for ; Tue, 14 Jul 2026 12:21:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784031715; cv=none; b=hy/8Wd5fPXgFgNRDzdcTXb8c44G9LM3uaUwoWEODUxq4YVl5nmaQHq6SBi++/im81xgmly1bO+2YjhflWJOgIr67pJi9tyEacad6YrxdLfG4UWfmTjVfO8RCLvY5cxzUOs4G84WZNLr7LHObdXZ6YQyrzAv3NLkzx2QoU16FyRE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784031715; c=relaxed/simple; bh=mDP0vSnLlZ6OAqYmIzsPfujTIjB7tAHKL3CMay061JM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NGcwvGBVD9Gw/Rsym6szUHpKdJdwRzZ+DUvvxONIgXBK/DUxnGnEqa5JlkMiRQZTK0u8Wsm81DWYUuT0A6gFaE7kh3YJx1ZWoDF5d94B/3MWRzg9ENktilLErbwxOJ4M8Y4ncIcTxRacYn3XkQ3f+5jKNpAD/1WL+WhjXiMZC+0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Z6ZEFkgG; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Z6ZEFkgG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784031709; x=1815567709; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=mDP0vSnLlZ6OAqYmIzsPfujTIjB7tAHKL3CMay061JM=; b=Z6ZEFkgGseT5qQQNyitBeUHU1A48pj05UDcdP6Xi+hLWXE+a3JJNNDj6 o8Jy59oNMpE8Lun9ZLhutJdYlDfGkfMXNjaLi/93ALog0GEbIX+eY57Xy ylkqZlzFu68dqq2NMXBhAen270YEAB004j3IsIzOjBYNdlfrrsgO22Lj9 JUROo1Fpc8e5qlNn+FDYyrm75fl2gS9sEf5DmlWPLrlhwx1ER/8A4Vz2F sfDfFsAUwtXaMFsHGUawwA1k79tuFs9etgmXHjWvjdITN6wH2Ingff98F hJolCvjmOpjxKlAn0LZIYFR+onPfRTCpSBWkMT94IKVtHtDKoweX85CxY g==; X-CSE-ConnectionGUID: aLufa1zjTYydSIWiS1478Q== X-CSE-MsgGUID: eOWLDlqeR0un6sl84Fi3XA== X-IronPort-AV: E=McAfee;i="6800,10657,11846"; a="84846476" X-IronPort-AV: E=Sophos;i="6.25,163,1779174000"; d="scan'208";a="84846476" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2026 05:21:47 -0700 X-CSE-ConnectionGUID: 2ud3g7bRTW+ot/GTeE6Keg== X-CSE-MsgGUID: QdZLJhdvT9asjZyuXV/qww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,163,1779174000"; d="scan'208";a="279108088" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa002.fm.intel.com with ESMTP; 14 Jul 2026 05:21:45 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 4BBA095; Tue, 14 Jul 2026 14:21:44 +0200 (CEST) From: Andy Shevchenko To: Petr Mladek , Andy Shevchenko , Tamir Duberstein , linux-kernel@vger.kernel.org Cc: Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , Andrew Morton Subject: [PATCH v1 1/1] lib/vsprintf: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols Date: Tue, 14 Jul 2026 14:21:43 +0200 Message-ID: <20260714122143.743227-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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 "); 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 /* for KSYM_SYMBOL_LEN */ #include #include +#include #include #include #include @@ -54,12 +55,13 @@ #include /* cpu_to_le16 */ #include -#include +#include + #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