* [PATCH] ACPI: APEI: EINJ: make einj_initialized static
@ 2026-03-25 3:46 Padmashree S S
2026-03-25 15:41 ` Luck, Tony
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Padmashree S S @ 2026-03-25 3:46 UTC (permalink / raw)
To: rafael, tony.luck
Cc: bp, guohanjun, mchehab, xueshuai, linux-acpi, linux-kernel,
Padmashree S S
Sparse reports a warning for einj_initialized being a global symbol
that is not declared static. The variable is only used within
einj-core.c, so mark it static to limit its scope and resolve the warning.
Signed-off-by: Padmashree S S <padmashreess2006@gmail.com>
---
drivers/acpi/apei/einj-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
index a9248af078f6..4a16c4b85a03 100644
--- a/drivers/acpi/apei/einj-core.c
+++ b/drivers/acpi/apei/einj-core.c
@@ -178,7 +178,7 @@ static DEFINE_MUTEX(einj_mutex);
/*
* Exported APIs use this flag to exit early if einj_probe() failed.
*/
-bool einj_initialized __ro_after_init;
+static bool einj_initialized __ro_after_init;
static void __iomem *einj_param;
static u32 v5param_size;
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* RE: [PATCH] ACPI: APEI: EINJ: make einj_initialized static 2026-03-25 3:46 [PATCH] ACPI: APEI: EINJ: make einj_initialized static Padmashree S S @ 2026-03-25 15:41 ` Luck, Tony 2026-03-25 16:02 ` Cheatham, Benjamin 2026-03-28 9:29 ` kernel test robot 2026-03-28 13:37 ` kernel test robot 2 siblings, 1 reply; 5+ messages in thread From: Luck, Tony @ 2026-03-25 15:41 UTC (permalink / raw) To: Padmashree S S, rafael@kernel.org, Ben Cheatham, Williams, Dan J Cc: bp@alien8.de, guohanjun@huawei.com, mchehab@kernel.org, xueshuai@linux.alibaba.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org > Sparse reports a warning for einj_initialized being a global symbol > that is not declared static. The variable is only used within > einj-core.c, so mark it static to limit its scope and resolve the warning. "git grep" is your friend: $ git grep einj_initialized drivers/acpi/apei/einj-core.c:bool einj_initialized __ro_after_init; drivers/acpi/apei/einj-core.c: einj_initialized = true; drivers/acpi/apei/einj-cxl.c:extern bool einj_initialized; drivers/acpi/apei/einj-cxl.c: return einj_initialized; Ben, Dan: Is there some header file that could carry the declaration of einj_initialized instead of the "extern" in drivers/acpi/apei/einj-cxl.c -Tony ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ACPI: APEI: EINJ: make einj_initialized static 2026-03-25 15:41 ` Luck, Tony @ 2026-03-25 16:02 ` Cheatham, Benjamin 0 siblings, 0 replies; 5+ messages in thread From: Cheatham, Benjamin @ 2026-03-25 16:02 UTC (permalink / raw) To: Luck, Tony, Padmashree S S, rafael@kernel.org, Williams, Dan J Cc: bp@alien8.de, guohanjun@huawei.com, mchehab@kernel.org, xueshuai@linux.alibaba.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org On 3/25/2026 10:41 AM, Luck, Tony wrote: >> Sparse reports a warning for einj_initialized being a global symbol >> that is not declared static. The variable is only used within >> einj-core.c, so mark it static to limit its scope and resolve the warning. > > "git grep" is your friend: > > $ git grep einj_initialized > drivers/acpi/apei/einj-core.c:bool einj_initialized __ro_after_init; > drivers/acpi/apei/einj-core.c: einj_initialized = true; > drivers/acpi/apei/einj-cxl.c:extern bool einj_initialized; > drivers/acpi/apei/einj-cxl.c: return einj_initialized; > > Ben, Dan: Is there some header file that could carry the declaration of einj_initialized > instead of the "extern" in drivers/acpi/apei/einj-cxl.c It *could* go into include/cxl/einj.h, but it's not really a cxl-specific symbol. If you (and Dan) are fine with muddying the waters on the cxl/einj divide, I think the patch below would work. I added a comment to hopefully avoid confusion in the future, but I'm not attached to it. I haven't built or tested it, so YMMV: Subject: [PATCH] ACPI: APEI: EINJ: Move einj_cxl_is_initialized() to einj-core Move einj_cxl_is_initialized() to einj-core.c to fix a sparse warning about einj_initialized being a non-static global symbol. Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com> --- drivers/acpi/apei/einj-core.c | 8 ++++++++ drivers/acpi/apei/einj-cxl.c | 9 --------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c index 305c240a303f..6ec4fb3632ad 100644 --- a/drivers/acpi/apei/einj-core.c +++ b/drivers/acpi/apei/einj-core.c @@ -23,6 +23,7 @@ #include <linux/mm.h> #include <linux/device/faux.h> #include <linux/unaligned.h> +#include <cxl/einj.h> #include "apei-internal.h" @@ -1173,6 +1174,13 @@ static struct faux_device_ops einj_device_ops = { .remove = einj_remove, }; +/* Used by CXL core to publish CXL-specific EINJ interface in CXL debugfs */ +bool einj_cxl_is_initialized(void) +{ + return einj_initialized; +} +EXPORT_SYMBOL_NS_GPL(einj_cxl_is_initialized, "CXL"); + static int __init einj_init(void) { if (acpi_disabled) { diff --git a/drivers/acpi/apei/einj-cxl.c b/drivers/acpi/apei/einj-cxl.c index e70a416ec925..a3070988f2b4 100644 --- a/drivers/acpi/apei/einj-cxl.c +++ b/drivers/acpi/apei/einj-cxl.c @@ -13,9 +13,6 @@ #include "apei-internal.h" -/* Defined in einj-core.c */ -extern bool einj_initialized; - static struct { u32 mask; const char *str; } const einj_cxl_error_type_string[] = { { ACPI_EINJ_CXL_CACHE_CORRECTABLE, "CXL.cache Protocol Correctable" }, { ACPI_EINJ_CXL_CACHE_UNCORRECTABLE, "CXL.cache Protocol Uncorrectable non-fatal" }, @@ -105,9 +102,3 @@ int einj_cxl_inject_error(struct pci_dev *dport, u64 type) return einj_error_inject(type, 0x4, 0, 0, 0, param4); } EXPORT_SYMBOL_NS_GPL(einj_cxl_inject_error, "CXL"); - -bool einj_cxl_is_initialized(void) -{ - return einj_initialized; -} -EXPORT_SYMBOL_NS_GPL(einj_cxl_is_initialized, "CXL"); -- 2.52.0 base-commit: 63fbf275fa9f18f7020fb8acf54fa107e51d0f23 (cxl-next in cxl.git) ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ACPI: APEI: EINJ: make einj_initialized static 2026-03-25 3:46 [PATCH] ACPI: APEI: EINJ: make einj_initialized static Padmashree S S 2026-03-25 15:41 ` Luck, Tony @ 2026-03-28 9:29 ` kernel test robot 2026-03-28 13:37 ` kernel test robot 2 siblings, 0 replies; 5+ messages in thread From: kernel test robot @ 2026-03-28 9:29 UTC (permalink / raw) To: Padmashree S S, rafael, tony.luck Cc: oe-kbuild-all, bp, guohanjun, mchehab, xueshuai, linux-acpi, linux-kernel, Padmashree S S Hi Padmashree, kernel test robot noticed the following build errors: [auto build test ERROR on rafael-pm/linux-next] [also build test ERROR on rafael-pm/bleeding-edge linus/master v7.0-rc5 next-20260327] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Padmashree-S-S/ACPI-APEI-EINJ-make-einj_initialized-static/20260328-022553 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20260325034626.405366-1-padmashreess2006%40gmail.com patch subject: [PATCH] ACPI: APEI: EINJ: make einj_initialized static config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260328/202603281058.fgnC9vIy-lkp@intel.com/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260328/202603281058.fgnC9vIy-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202603281058.fgnC9vIy-lkp@intel.com/ All errors (new ones prefixed by >>, old ones prefixed by <<): >> ERROR: modpost: "einj_initialized" [drivers/acpi/apei/einj.ko] undefined! -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ACPI: APEI: EINJ: make einj_initialized static 2026-03-25 3:46 [PATCH] ACPI: APEI: EINJ: make einj_initialized static Padmashree S S 2026-03-25 15:41 ` Luck, Tony 2026-03-28 9:29 ` kernel test robot @ 2026-03-28 13:37 ` kernel test robot 2 siblings, 0 replies; 5+ messages in thread From: kernel test robot @ 2026-03-28 13:37 UTC (permalink / raw) To: Padmashree S S, rafael, tony.luck Cc: oe-kbuild-all, bp, guohanjun, mchehab, xueshuai, linux-acpi, linux-kernel, Padmashree S S Hi Padmashree, kernel test robot noticed the following build errors: [auto build test ERROR on rafael-pm/linux-next] [also build test ERROR on rafael-pm/bleeding-edge linus/master v7.0-rc5 next-20260327] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Padmashree-S-S/ACPI-APEI-EINJ-make-einj_initialized-static/20260328-022553 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20260325034626.405366-1-padmashreess2006%40gmail.com patch subject: [PATCH] ACPI: APEI: EINJ: make einj_initialized static config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260328/202603282131.etycgFYz-lkp@intel.com/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260328/202603282131.etycgFYz-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202603282131.etycgFYz-lkp@intel.com/ All errors (new ones prefixed by >>, old ones prefixed by <<): >> ERROR: modpost: "einj_initialized" [drivers/acpi/apei/einj.ko] undefined! -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-28 13:38 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-03-25 3:46 [PATCH] ACPI: APEI: EINJ: make einj_initialized static Padmashree S S 2026-03-25 15:41 ` Luck, Tony 2026-03-25 16:02 ` Cheatham, Benjamin 2026-03-28 9:29 ` kernel test robot 2026-03-28 13:37 ` kernel test robot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox