Skip to content

Commit

Permalink
RAS: Export helper to get ras_debugfs_dir
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Borislav Petkov (AMD) committed Mar 1, 2024
1 parent dd61b55 commit 9d2b6fa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions drivers/ras/cec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion drivers/ras/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/ras/debugfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */

0 comments on commit 9d2b6fa

Please sign in to comment.