Commit 5e7e6472 authored by Qinglang Miao's avatar Qinglang Miao Committed by Martin K. Petersen

scsi: qla2xxx: Convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Link: https://lore.kernel.org/r/20200919025202.17531-1-miaoqinglang@huawei.comReviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Acked-by: default avatarArun Easi <aeasi@marvell.com>
Signed-off-by: default avatarQinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 21a6cd48
...@@ -171,20 +171,7 @@ qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused) ...@@ -171,20 +171,7 @@ qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int DEFINE_SHOW_ATTRIBUTE(qla2x00_dfs_tgt_sess);
qla2x00_dfs_tgt_sess_open(struct inode *inode, struct file *file)
{
scsi_qla_host_t *vha = inode->i_private;
return single_open(file, qla2x00_dfs_tgt_sess_show, vha);
}
static const struct file_operations dfs_tgt_sess_ops = {
.open = qla2x00_dfs_tgt_sess_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int static int
qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused) qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
...@@ -240,20 +227,7 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused) ...@@ -240,20 +227,7 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int DEFINE_SHOW_ATTRIBUTE(qla2x00_dfs_tgt_port_database);
qla2x00_dfs_tgt_port_database_open(struct inode *inode, struct file *file)
{
scsi_qla_host_t *vha = inode->i_private;
return single_open(file, qla2x00_dfs_tgt_port_database_show, vha);
}
static const struct file_operations dfs_tgt_port_database_ops = {
.open = qla2x00_dfs_tgt_port_database_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int static int
qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused) qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
...@@ -302,20 +276,7 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused) ...@@ -302,20 +276,7 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int DEFINE_SHOW_ATTRIBUTE(qla_dfs_fw_resource_cnt);
qla_dfs_fw_resource_cnt_open(struct inode *inode, struct file *file)
{
struct scsi_qla_host *vha = inode->i_private;
return single_open(file, qla_dfs_fw_resource_cnt_show, vha);
}
static const struct file_operations dfs_fw_resource_cnt_ops = {
.open = qla_dfs_fw_resource_cnt_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int static int
qla_dfs_tgt_counters_show(struct seq_file *s, void *unused) qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
...@@ -392,20 +353,7 @@ qla_dfs_tgt_counters_show(struct seq_file *s, void *unused) ...@@ -392,20 +353,7 @@ qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int DEFINE_SHOW_ATTRIBUTE(qla_dfs_tgt_counters);
qla_dfs_tgt_counters_open(struct inode *inode, struct file *file)
{
struct scsi_qla_host *vha = inode->i_private;
return single_open(file, qla_dfs_tgt_counters_show, vha);
}
static const struct file_operations dfs_tgt_counters_ops = {
.open = qla_dfs_tgt_counters_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int static int
qla2x00_dfs_fce_show(struct seq_file *s, void *unused) qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
...@@ -607,19 +555,19 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha) ...@@ -607,19 +555,19 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha)
create_nodes: create_nodes:
ha->dfs_fw_resource_cnt = debugfs_create_file("fw_resource_count", ha->dfs_fw_resource_cnt = debugfs_create_file("fw_resource_count",
S_IRUSR, ha->dfs_dir, vha, &dfs_fw_resource_cnt_ops); S_IRUSR, ha->dfs_dir, vha, &qla_dfs_fw_resource_cnt_fops);
ha->dfs_tgt_counters = debugfs_create_file("tgt_counters", S_IRUSR, ha->dfs_tgt_counters = debugfs_create_file("tgt_counters", S_IRUSR,
ha->dfs_dir, vha, &dfs_tgt_counters_ops); ha->dfs_dir, vha, &qla_dfs_tgt_counters_fops);
ha->tgt.dfs_tgt_port_database = debugfs_create_file("tgt_port_database", ha->tgt.dfs_tgt_port_database = debugfs_create_file("tgt_port_database",
S_IRUSR, ha->dfs_dir, vha, &dfs_tgt_port_database_ops); S_IRUSR, ha->dfs_dir, vha, &qla2x00_dfs_tgt_port_database_fops);
ha->dfs_fce = debugfs_create_file("fce", S_IRUSR, ha->dfs_dir, vha, ha->dfs_fce = debugfs_create_file("fce", S_IRUSR, ha->dfs_dir, vha,
&dfs_fce_ops); &dfs_fce_ops);
ha->tgt.dfs_tgt_sess = debugfs_create_file("tgt_sess", ha->tgt.dfs_tgt_sess = debugfs_create_file("tgt_sess",
S_IRUSR, ha->dfs_dir, vha, &dfs_tgt_sess_ops); S_IRUSR, ha->dfs_dir, vha, &qla2x00_dfs_tgt_sess_fops);
if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) { if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) {
ha->tgt.dfs_naqp = debugfs_create_file("naqp", ha->tgt.dfs_naqp = debugfs_create_file("naqp",
......
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