Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+16 -4
+8 -2
drivers/ras/cec.c
··· 480 480 481 481 static int __init create_debugfs_nodes(void) 482 482 { 483 - struct dentry *d, *pfn, *decay, *count, *array; 483 + struct dentry *d, *pfn, *decay, *count, *array, *dfs; 484 484 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); 486 492 if (!d) { 487 493 pr_warn("Error creating cec debugfs node!\n"); 488 494 return -1;
+7 -1
drivers/ras/debugfs.c
··· 3 3 #include <linux/ras.h> 4 4 #include "debugfs.h" 5 5 6 - struct dentry *ras_debugfs_dir; 6 + static struct dentry *ras_debugfs_dir; 7 7 8 8 static atomic_t trace_count = ATOMIC_INIT(0); 9 + 10 + struct dentry *ras_get_debugfs_root(void) 11 + { 12 + return ras_debugfs_dir; 13 + } 14 + EXPORT_SYMBOL_GPL(ras_get_debugfs_root); 9 15 10 16 int ras_userspace_consumers(void) 11 17 {
+1 -1
drivers/ras/debugfs.h
··· 4 4 5 5 #include <linux/debugfs.h> 6 6 7 - extern struct dentry *ras_debugfs_dir; 7 + struct dentry *ras_get_debugfs_root(void); 8 8 9 9 #endif /* __RAS_DEBUGFS_H__ */