Commit 4bd442e9 authored by Qinglang Miao's avatar Qinglang Miao Committed by Borislav Petkov

RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE()

Use the DEFINE_SHOW_ATTRIBUTE() macro and simplify the code.
Signed-off-by: default avatarQinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200919012252.171437-1-miaoqinglang@huawei.com
parent e1007770
...@@ -435,7 +435,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(action_threshold_ops, u64_get, action_threshold_set, "% ...@@ -435,7 +435,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(action_threshold_ops, u64_get, action_threshold_set, "%
static const char * const bins[] = { "00", "01", "10", "11" }; static const char * const bins[] = { "00", "01", "10", "11" };
static int array_dump(struct seq_file *m, void *v) static int array_show(struct seq_file *m, void *v)
{ {
struct ce_array *ca = &ce_arr; struct ce_array *ca = &ce_arr;
int i; int i;
...@@ -467,18 +467,7 @@ static int array_dump(struct seq_file *m, void *v) ...@@ -467,18 +467,7 @@ static int array_dump(struct seq_file *m, void *v)
return 0; return 0;
} }
static int array_open(struct inode *inode, struct file *filp) DEFINE_SHOW_ATTRIBUTE(array);
{
return single_open(filp, array_dump, NULL);
}
static const struct file_operations array_ops = {
.owner = THIS_MODULE,
.open = array_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int __init create_debugfs_nodes(void) static int __init create_debugfs_nodes(void)
{ {
...@@ -513,7 +502,7 @@ static int __init create_debugfs_nodes(void) ...@@ -513,7 +502,7 @@ static int __init create_debugfs_nodes(void)
goto err; goto err;
} }
array = debugfs_create_file("array", S_IRUSR, d, NULL, &array_ops); array = debugfs_create_file("array", S_IRUSR, d, NULL, &array_fops);
if (!array) { if (!array) {
pr_warn("Error creating array debugfs node!\n"); pr_warn("Error creating array debugfs node!\n");
goto err; goto err;
......
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