Skip to contentSkip to conversation

fault_inject: Replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE

PATCH In review Jiapeng Chong 2 participants 2 messages Feb 1, 2021 – Feb 2, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fault_inject: Replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE

Fix the following coccicheck warning:

./lib/fault-inject.c:187:0-23: WARNING: fops_stacktrace_depth should be defined with DEFINE_DEBUGFS_ATTRIBUTE.

./lib/fault-inject.c:169:0-23: WARNING: fops_ul should be defined with DEFINE_DEBUGFS_ATTRIBUTE.

---
 lib/fault-inject.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/fault-inject.c +3 -3
index ce12621..cb7ea22 100644
@@ -166,7 +166,7 @@ static int debugfs_ul_get(void *data, u64 *val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_ul, debugfs_ul_get, debugfs_ul_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_ul, debugfs_ul_get, debugfs_ul_set, "%llu\n");
 
 static void debugfs_create_ul(const char *name, umode_t mode,
 			      struct dentry *parent, unsigned long *value)
@@ -184,8 +184,8 @@ static int debugfs_stacktrace_depth_set(void *data, u64 val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_stacktrace_depth, debugfs_ul_get,
-			debugfs_stacktrace_depth_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_stacktrace_depth, debugfs_ul_get,
+			  debugfs_stacktrace_depth_set, "%llu\n");
 
 static void debugfs_create_stacktrace_depth(const char *name, umode_t mode,
 					    struct dentry *parent,
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw

2021年2月1日(月) 16:43 Jiapeng Chong <[email protected]>:

Quoted 20 lines

Fix the following coccicheck warning:

./lib/fault-inject.c:187:0-23: WARNING: fops_stacktrace_depth should be defined with DEFINE_DEBUGFS_ATTRIBUTE.

./lib/fault-inject.c:169:0-23: WARNING: fops_ul should be defined with DEFINE_DEBUGFS_ATTRIBUTE.

---
 lib/fault-inject.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/fault-inject.c +0 -0
index ce12621..cb7ea22 100644

lib/fault-inject.c static int debugfs_ul_get(void *data, u64 *val) · line 172

Quoted 8 lines
lib/fault-inject.c +1 -1
@@ -166,7 +166,7 @@ static int debugfs_ul_get(void *data, u64 *val)
        return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_ul, debugfs_ul_get, debugfs_ul_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_ul, debugfs_ul_get, debugfs_ul_set, "%llu\n");
 
 static void debugfs_create_ul(const char *name, umode_t mode,
                              struct dentry *parent, unsigned long *value)

Could you just remove this fops_ul stuff and use debugfs_create_ulong() instead?