Skip to content

Commit 9d2b6fa

Browse files
committed
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
1 parent dd61b55 commit 9d2b6fa

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

drivers/ras/cec.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,15 @@ DEFINE_SHOW_ATTRIBUTE(array);
480480

481481
static int __init create_debugfs_nodes(void)
482482
{
483-
struct dentry *d, *pfn, *decay, *count, *array;
483+
struct dentry *d, *pfn, *decay, *count, *array, *dfs;
484484

485-
d = debugfs_create_dir("cec", ras_debugfs_dir);
485+
dfs = ras_get_debugfs_root();
486+
if (!dfs) {
487+
pr_warn("Error getting RAS debugfs root!\n");
488+
return -1;
489+
}
490+
491+
d = debugfs_create_dir("cec", dfs);
486492
if (!d) {
487493
pr_warn("Error creating cec debugfs node!\n");
488494
return -1;

drivers/ras/debugfs.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
#include <linux/ras.h>
44
#include "debugfs.h"
55

6-
struct dentry *ras_debugfs_dir;
6+
static struct dentry *ras_debugfs_dir;
77

88
static atomic_t trace_count = ATOMIC_INIT(0);
99

10+
struct dentry *ras_get_debugfs_root(void)
11+
{
12+
return ras_debugfs_dir;
13+
}
14+
EXPORT_SYMBOL_GPL(ras_get_debugfs_root);
15+
1016
int ras_userspace_consumers(void)
1117
{
1218
return atomic_read(&trace_count);

drivers/ras/debugfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
#include <linux/debugfs.h>
66

7-
extern struct dentry *ras_debugfs_dir;
7+
struct dentry *ras_get_debugfs_root(void);
88

99
#endif /* __RAS_DEBUGFS_H__ */

0 commit comments

Comments
 (0)