[PATCH] notifier-error-inject: use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops

From: zhong jiang
Date: Thu Oct 31 2019 - 08:46:16 EST


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().

Signed-off-by: zhong jiang <zhongjiang@xxxxxxxxxx>
---
lib/notifier-error-inject.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/notifier-error-inject.c b/lib/notifier-error-inject.c
index 21016b3..e5302f7 100644
--- a/lib/notifier-error-inject.c
+++ b/lib/notifier-error-inject.c
@@ -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,
--
1.7.12.4