From: Yazen Ghannam <yazen.ghannam@amd.com>
To: <bp@alien8.de>, <tony.luck@intel.com>, <linux-edac@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <avadhut.naik@amd.com>,
<john.allen@amd.com>, <muralidhara.mk@amd.com>,
<sathyapriya.k@amd.com>, <naveenkrishna.chatradhi@amd.com>,
Yazen Ghannam <yazen.ghannam@amd.com>
Subject: [PATCH v2 1/3] RAS: Export helper to get ras_debugfs_dir
Date: Fri, 1 Mar 2024 08:37:46 -0600 [thread overview]
Message-ID: <20240301143748.854090-2-yazen.ghannam@amd.com> (raw)
In-Reply-To: <20240301143748.854090-1-yazen.ghannam@amd.com>
From: "Borislav Petkov (AMD)" <bp@alien8.de>
...so that RAS modules can use it.
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
Link:
https://lore.kernel.org/r/20240226152941.2615007-2-yazen.ghannam@amd.com
v1->v2:
* Replace with patch from Boris to export a function.
* Added commit message and authorship to patch from Boris.
drivers/ras/cec.c | 10 ++++++++--
drivers/ras/debugfs.c | 8 +++++++-
drivers/ras/debugfs.h | 2 +-
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index 321af498ee11..e440b15fbabc 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -480,9 +480,15 @@ DEFINE_SHOW_ATTRIBUTE(array);
static int __init create_debugfs_nodes(void)
{
- struct dentry *d, *pfn, *decay, *count, *array;
+ struct dentry *d, *pfn, *decay, *count, *array, *dfs;
- d = debugfs_create_dir("cec", ras_debugfs_dir);
+ dfs = ras_get_debugfs_root();
+ if (!dfs) {
+ pr_warn("Error getting RAS debugfs root!\n");
+ return -1;
+ }
+
+ d = debugfs_create_dir("cec", dfs);
if (!d) {
pr_warn("Error creating cec debugfs node!\n");
return -1;
diff --git a/drivers/ras/debugfs.c b/drivers/ras/debugfs.c
index ffb973c328e3..42afd3de68b2 100644
--- a/drivers/ras/debugfs.c
+++ b/drivers/ras/debugfs.c
@@ -3,10 +3,16 @@
#include <linux/ras.h>
#include "debugfs.h"
-struct dentry *ras_debugfs_dir;
+static struct dentry *ras_debugfs_dir;
static atomic_t trace_count = ATOMIC_INIT(0);
+struct dentry *ras_get_debugfs_root(void)
+{
+ return ras_debugfs_dir;
+}
+EXPORT_SYMBOL_GPL(ras_get_debugfs_root);
+
int ras_userspace_consumers(void)
{
return atomic_read(&trace_count);
diff --git a/drivers/ras/debugfs.h b/drivers/ras/debugfs.h
index c07443b462ad..4749ccdeeba1 100644
--- a/drivers/ras/debugfs.h
+++ b/drivers/ras/debugfs.h
@@ -4,6 +4,6 @@
#include <linux/debugfs.h>
-extern struct dentry *ras_debugfs_dir;
+struct dentry *ras_get_debugfs_root(void);
#endif /* __RAS_DEBUGFS_H__ */
--
2.34.1
next prev parent reply other threads:[~2024-03-01 14:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 14:37 [PATCH v2 0/3] FMPM Debug Updates Yazen Ghannam
2024-03-01 14:37 ` Yazen Ghannam [this message]
2024-03-01 14:37 ` [PATCH v2 2/3] RAS/AMD/FMPM: Save SPA values Yazen Ghannam
2024-03-01 15:50 ` Borislav Petkov
2024-03-01 14:37 ` [PATCH v2 3/3] RAS/AMD/FMPM: Add debugfs interface to print record entries Yazen Ghannam
2024-03-02 9:49 ` [PATCH v2 0/3] FMPM Debug Updates Borislav Petkov
2024-03-04 5:13 ` M K, Muralidhara
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=20240301143748.854090-2-yazen.ghannam@amd.com \
--to=yazen.ghannam@amd.com \
--cc=avadhut.naik@amd.com \
--cc=bp@alien8.de \
--cc=john.allen@amd.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=muralidhara.mk@amd.com \
--cc=naveenkrishna.chatradhi@amd.com \
--cc=sathyapriya.k@amd.com \
--cc=tony.luck@intel.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;
as well as URLs for NNTP newsgroup(s).