Patchwork [v1,3/4] EDAC, skx_edac: Clean up debugfs

login
register
mail settings
Submitter Qiuxu Zhuo
Date Nov. 16, 2018, 7:34 a.m.
Message ID <1542353684-13496-1-git-send-email-qiuxu.zhuo@intel.com>
Download mbox | patch
Permalink /patch/658313/
State New
Headers show

Comments

Qiuxu Zhuo - Nov. 16, 2018, 7:34 a.m.
1) The skx_edac debugfs node is '/sys/kernel/debug/skx_edac_test,
   rename it and move under EDAC debugfs root directory.
2) Remove the unused 'skx_fake_addr'.
3) Remove the 'skx_test' on error.

Co-developed-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
---
 drivers/edac/skx_edac.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

Patch

diff --git a/drivers/edac/skx_edac.c b/drivers/edac/skx_edac.c
index d8869f05c596..6d38701c1b2e 100644
--- a/drivers/edac/skx_edac.c
+++ b/drivers/edac/skx_edac.c
@@ -923,12 +923,11 @@  static bool skx_decode(struct decoded_addr *res)
 
 #ifdef CONFIG_EDAC_DEBUG
 /*
- * Debug feature. Make /sys/kernel/debug/skx_edac_test/addr.
- * Write an address to this file to exercise the address decode
- * logic in this driver.
+ * Debug feature.
+ * Exercise the address decode logic by writing an address to
+ * /sys/kernel/debug/edac/skx_test/addr.
  */
 static struct dentry *skx_test;
-static u64 skx_fake_addr;
 
 static int debugfs_u64_set(void *data, u64 val)
 {
@@ -939,19 +938,19 @@  static int debugfs_u64_set(void *data, u64 val)
 
 	return 0;
 }
-
 DEFINE_SIMPLE_ATTRIBUTE(fops_u64_wo, NULL, debugfs_u64_set, "%llu\n");
 
-static struct dentry *mydebugfs_create(const char *name, umode_t mode,
-				       struct dentry *parent, u64 *value)
-{
-	return debugfs_create_file(name, mode, parent, value, &fops_u64_wo);
-}
-
 static void setup_skx_debug(void)
 {
-	skx_test = debugfs_create_dir("skx_edac_test", NULL);
-	mydebugfs_create("addr", S_IWUSR, skx_test, &skx_fake_addr);
+	skx_test = edac_debugfs_create_dir("skx_test");
+	if (!skx_test)
+		return;
+
+	if (!edac_debugfs_create_file("addr", 0200, skx_test,
+				      NULL, &fops_u64_wo)) {
+		debugfs_remove(skx_test);
+		skx_test = NULL;
+	}
 }
 
 static void teardown_skx_debug(void)