mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Cheatham, Benjamin" <benjamin.cheatham@amd.com>
To: "Luck, Tony" <tony.luck@intel.com>,
	Padmashree S S <padmashreess2006@gmail.com>,
	"rafael@kernel.org" <rafael@kernel.org>,
	"Williams, Dan J" <dan.j.williams@intel.com>
Cc: "bp@alien8.de" <bp@alien8.de>,
	"guohanjun@huawei.com" <guohanjun@huawei.com>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"xueshuai@linux.alibaba.com" <xueshuai@linux.alibaba.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ACPI: APEI: EINJ: make einj_initialized static
Date: Wed, 25 Mar 2026 11:02:08 -0500	[thread overview]
Message-ID: <78660163-0f51-4989-9bbf-ea60519fb183@amd.com> (raw)
In-Reply-To: <SJ1PR11MB6083D15B882275321105286EFC49A@SJ1PR11MB6083.namprd11.prod.outlook.com>

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)

  reply	other threads:[~2026-03-25 16:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25  3:46 Padmashree S S
2026-03-25 15:41 ` Luck, Tony
2026-03-25 16:02   ` Cheatham, Benjamin [this message]
2026-03-28  9:29 ` kernel test robot
2026-03-28 13:37 ` kernel test robot

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=78660163-0f51-4989-9bbf-ea60519fb183@amd.com \
    --to=benjamin.cheatham@amd.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=guohanjun@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=padmashreess2006@gmail.com \
    --cc=rafael@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=xueshuai@linux.alibaba.com \
    /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®