ACPI: APEI: EINJ: make einj_initialized static
PATCH 1/1 ACPI: APEI: EINJ: make einj_initialized static
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.
--- drivers/acpi/apei/einj-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/apei/einj-core.c +1 -1
@@ -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;
Signature · 1 line
2.43.0
Luck, Tony
reviewerQuoted 3 lines
Sparse reports a warning for
einj_initializedbeing a global symbol that is not declared static. The variable is only used withineinj-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
Quoted 6 lines · Tony
Quoted 3 lines
Sparse reports a warning for
einj_initializedbeing a global symbol that is not declared static. The variable is only used withineinj-core.c, so mark it static to limit its scope and resolve the warning."git grep" is your friend:
Quoted 8 lines
$ 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_initializedinstead of the "extern" indrivers/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.
--- drivers/acpi/apei/einj-core.c | 8 ++++++++ drivers/acpi/apei/einj-cxl.c | 9 --------- 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/acpi/apei/einj-core.c +8 -0
@@ -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) {
drivers/acpi/apei/einj-cxl.c +0 -9
@@ -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" );
Signature · 3 lines
2.52.0 base-commit: 63fbf275fa9f18f7020fb8acf54fa107e51d0f23 (cxl-next in cxl.git)
kernel test robot
build botkernel test robot noticed the following build errors:
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "einj_initialized" [drivers/acpi/apei/einj.ko] undefined!
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "einj_initialized" [drivers/acpi/apei/einj.ko] undefined!
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki