Skip to content
Permalink
Browse files
scsi: qla2xxx: Introduce DEFINE_SHOW_STORE_ATTRIBUTE for debugfs
Seq introduce a new helper macro DEFINE_SHOW_STORE_ATTRIBUTE for
Read-Write file, so we apply it at qla2xxx to reduce some duplicated code.

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
  • Loading branch information
Luojiaxing1991 authored and intel-lab-lkp committed Nov 12, 2020
1 parent 3d23632 commit cdd2edc795fcbb643f104476d99a52d0e95bb229
Showing 1 changed file with 2 additions and 17 deletions.
@@ -461,14 +461,6 @@ qla_dfs_naqp_show(struct seq_file *s, void *unused)
return 0;
}

static int
qla_dfs_naqp_open(struct inode *inode, struct file *file)
{
struct scsi_qla_host *vha = inode->i_private;

return single_open(file, qla_dfs_naqp_show, vha);
}

static ssize_t
qla_dfs_naqp_write(struct file *file, const char __user *buffer,
size_t count, loff_t *pos)
@@ -517,14 +509,7 @@ qla_dfs_naqp_write(struct file *file, const char __user *buffer,
return rc;
}

static const struct file_operations dfs_naqp_ops = {
.open = qla_dfs_naqp_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = qla_dfs_naqp_write,
};

DEFINE_SHOW_STORE_ATTRIBUTE(qla_dfs_naqp);

int
qla2x00_dfs_setup(scsi_qla_host_t *vha)
@@ -570,7 +555,7 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha)

if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) {
ha->tgt.dfs_naqp = debugfs_create_file("naqp",
0400, ha->dfs_dir, vha, &dfs_naqp_ops);
0400, ha->dfs_dir, vha, &qla_dfs_naqp_ops);
if (!ha->tgt.dfs_naqp) {
ql_log(ql_log_warn, vha, 0xd011,
"Unable to create debugFS naqp node.\n");

0 comments on commit cdd2edc

Please sign in to comment.