Commit 63d6c981 authored by Wang Qing's avatar Wang Qing Committed by Thomas Bogendoerfer

mips: kernel: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

debugfs_create_file_unsafe does not protect the fops handed to it
against file removal. DEFINE_DEBUGFS_ATTRIBUTE makes the fops aware of
the file lifetime and thus protects it against removal.
Signed-off-by: default avatarWang Qing <wangqing@vivo.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent c6972fb9
...@@ -35,7 +35,7 @@ static int ss_get(void *data, u64 *val) ...@@ -35,7 +35,7 @@ static int ss_get(void *data, u64 *val)
return 0; return 0;
} }
DEFINE_SIMPLE_ATTRIBUTE(fops_ss, ss_get, NULL, "%llu\n"); DEFINE_DEBUGFS_ATTRIBUTE(fops_ss, ss_get, NULL, "%llu\n");
...@@ -114,13 +114,13 @@ static int multi_get(void *data, u64 *val) ...@@ -114,13 +114,13 @@ static int multi_get(void *data, u64 *val)
return 0; return 0;
} }
DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n"); DEFINE_DEBUGFS_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n");
static int __init spinlock_test(void) static int __init spinlock_test(void)
{ {
debugfs_create_file("spin_single", S_IRUGO, mips_debugfs_dir, NULL, debugfs_create_file_unsafe("spin_single", S_IRUGO, mips_debugfs_dir, NULL,
&fops_ss); &fops_ss);
debugfs_create_file("spin_multi", S_IRUGO, mips_debugfs_dir, NULL, debugfs_create_file_unsafe("spin_multi", S_IRUGO, mips_debugfs_dir, NULL,
&fops_multi); &fops_multi);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment