Skip to contentSkip to conversation

notifier-error-inject: use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops

PATCH New zhong jiang 1 participant 1 message Oct 31, 2019 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 notifier-error-inject: use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops

It is more clearly to use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs file operation rather than DEFINE_SIMPLE_ATTRIBUTE.

Meanwhile, debugfs_create_file() in debugfs_create_errno() can be replaced by debugfs_create_file_unsafe().

---
 lib/notifier-error-inject.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/notifier-error-inject.c +2 -2
index 21016b3..e5302f7 100644
@@ -15,13 +15,13 @@ static int debugfs_errno_get(void *data, u64 *val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_errno, debugfs_errno_get, debugfs_errno_set,
+DEFINE_DEBUGFS_ATTRIBUTE(fops_errno, debugfs_errno_get, debugfs_errno_set,
 			"%lld\n");
 
 static struct dentry *debugfs_create_errno(const char *name, umode_t mode,
 				struct dentry *parent, int *value)
 {
-	return debugfs_create_file(name, mode, parent, value, &fops_errno);
+	return debugfs_create_file_unsafe(name, mode, parent, value, &fops_errno);
 }
 
 static int notifier_err_inject_callback(struct notifier_block *nb,
Signature · 1 line
1.7.12.4