diff options
author | Borislav Petkov (AMD) <bp@alien8.de> | 2024-03-01 17:37:46 +0300 |
---|---|---|
committer | Borislav Petkov (AMD) <bp@alien8.de> | 2024-03-01 18:55:10 +0300 |
commit | 9d2b6fa09d15d021fb83ec6f1336176ebaebbeec (patch) | |
tree | 31797afc1d79560dc0b72e54f5286256f6a91c38 /drivers/ras | |
parent | dd61b55d733eee9bbe51abe7ab0e6f2ce1fae332 (diff) | |
download | linux-9d2b6fa09d15d021fb83ec6f1336176ebaebbeec.tar.xz |
RAS: Export helper to get ras_debugfs_dir
Export a getter instead of the debugfs node directly so that, other
in-tree-only 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/20240301143748.854090-2-yazen.ghannam@amd.com
Diffstat (limited to 'drivers/ras')
-rw-r--r-- | drivers/ras/cec.c | 10 | ||||
-rw-r--r-- | drivers/ras/debugfs.c | 8 | ||||
-rw-r--r-- | 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__ */ |