Commit ef688fc7 authored by Yangtao Li's avatar Yangtao Li Committed by Andy Shevchenko

platform/x86: intel_telemetry: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: default avatarYangtao Li <tiny.windzz@gmail.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 3b1f9955
...@@ -466,17 +466,7 @@ static int telem_pss_states_show(struct seq_file *s, void *unused) ...@@ -466,17 +466,7 @@ static int telem_pss_states_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int telem_pss_state_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(telem_pss_states);
{
return single_open(file, telem_pss_states_show, inode->i_private);
}
static const struct file_operations telem_pss_ops = {
.open = telem_pss_state_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int telem_ioss_states_show(struct seq_file *s, void *unused) static int telem_ioss_states_show(struct seq_file *s, void *unused)
{ {
...@@ -505,17 +495,7 @@ static int telem_ioss_states_show(struct seq_file *s, void *unused) ...@@ -505,17 +495,7 @@ static int telem_ioss_states_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int telem_ioss_state_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(telem_ioss_states);
{
return single_open(file, telem_ioss_states_show, inode->i_private);
}
static const struct file_operations telem_ioss_ops = {
.open = telem_ioss_state_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int telem_soc_states_show(struct seq_file *s, void *unused) static int telem_soc_states_show(struct seq_file *s, void *unused)
{ {
...@@ -664,17 +644,7 @@ static int telem_soc_states_show(struct seq_file *s, void *unused) ...@@ -664,17 +644,7 @@ static int telem_soc_states_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int telem_soc_state_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(telem_soc_states);
{
return single_open(file, telem_soc_states_show, inode->i_private);
}
static const struct file_operations telem_socstate_ops = {
.open = telem_soc_state_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int telem_s0ix_res_get(void *data, u64 *val) static int telem_s0ix_res_get(void *data, u64 *val)
{ {
...@@ -960,7 +930,7 @@ static int __init telemetry_debugfs_init(void) ...@@ -960,7 +930,7 @@ static int __init telemetry_debugfs_init(void)
f = debugfs_create_file("pss_info", S_IFREG | S_IRUGO, f = debugfs_create_file("pss_info", S_IFREG | S_IRUGO,
debugfs_conf->telemetry_dbg_dir, NULL, debugfs_conf->telemetry_dbg_dir, NULL,
&telem_pss_ops); &telem_pss_states_fops);
if (!f) { if (!f) {
pr_err("pss_sample_info debugfs register failed\n"); pr_err("pss_sample_info debugfs register failed\n");
goto out; goto out;
...@@ -968,7 +938,7 @@ static int __init telemetry_debugfs_init(void) ...@@ -968,7 +938,7 @@ static int __init telemetry_debugfs_init(void)
f = debugfs_create_file("ioss_info", S_IFREG | S_IRUGO, f = debugfs_create_file("ioss_info", S_IFREG | S_IRUGO,
debugfs_conf->telemetry_dbg_dir, NULL, debugfs_conf->telemetry_dbg_dir, NULL,
&telem_ioss_ops); &telem_ioss_states_fops);
if (!f) { if (!f) {
pr_err("ioss_sample_info debugfs register failed\n"); pr_err("ioss_sample_info debugfs register failed\n");
goto out; goto out;
...@@ -976,7 +946,7 @@ static int __init telemetry_debugfs_init(void) ...@@ -976,7 +946,7 @@ static int __init telemetry_debugfs_init(void)
f = debugfs_create_file("soc_states", S_IFREG | S_IRUGO, f = debugfs_create_file("soc_states", S_IFREG | S_IRUGO,
debugfs_conf->telemetry_dbg_dir, debugfs_conf->telemetry_dbg_dir,
NULL, &telem_socstate_ops); NULL, &telem_soc_states_fops);
if (!f) { if (!f) {
pr_err("ioss_sample_info debugfs register failed\n"); pr_err("ioss_sample_info debugfs register failed\n");
goto out; goto out;
......
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