* [PATCH -next v2] scsi: qla2xxx: Convert to DEFINE_SHOW_ATTRIBUTE
@ 2020-09-19 2:52 Qinglang Miao
2020-10-07 13:35 ` Himanshu Madhani
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Qinglang Miao @ 2020-09-19 2:52 UTC (permalink / raw)
To: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
Martin K. Petersen
Cc: linux-scsi, linux-kernel, Qinglang Miao
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
v2: based on linux-next(20200917), and can be applied to
mainline cleanly now.
drivers/scsi/qla2xxx/qla_dfs.c | 68 ++++------------------------------
1 file changed, 8 insertions(+), 60 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index e62b21152..9e49b47f6 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -37,20 +37,7 @@ qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused)
return 0;
}
-static int
-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,
-};
+DEFINE_SHOW_ATTRIBUTE(qla2x00_dfs_tgt_sess);
static int
qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
@@ -106,20 +93,7 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
return 0;
}
-static int
-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,
-};
+DEFINE_SHOW_ATTRIBUTE(qla2x00_dfs_tgt_port_database);
static int
qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
@@ -154,20 +128,7 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
return 0;
}
-static int
-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,
-};
+DEFINE_SHOW_ATTRIBUTE(qla_dfs_fw_resource_cnt);
static int
qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
@@ -244,20 +205,7 @@ qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
return 0;
}
-static int
-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,
-};
+DEFINE_SHOW_ATTRIBUTE(qla_dfs_tgt_counters);
static int
qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
@@ -459,19 +407,19 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha)
create_nodes:
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_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",
- 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,
&dfs_fce_ops);
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))
ha->tgt.dfs_naqp = debugfs_create_file("naqp",
--
2.23.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH -next v2] scsi: qla2xxx: Convert to DEFINE_SHOW_ATTRIBUTE
2020-09-19 2:52 [PATCH -next v2] scsi: qla2xxx: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
@ 2020-10-07 13:35 ` Himanshu Madhani
2020-10-08 2:24 ` Martin K. Petersen
2020-10-07 17:12 ` Arun Easi
2020-10-13 22:42 ` Martin K. Petersen
2 siblings, 1 reply; 5+ messages in thread
From: Himanshu Madhani @ 2020-10-07 13:35 UTC (permalink / raw)
To: Qinglang Miao
Cc: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
Martin K. Petersen, linux-scsi, linux-kernel
> On Sep 18, 2020, at 9:52 PM, Qinglang Miao <miaoqinglang@huawei.com> wrote:
>
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
>
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> ---
> v2: based on linux-next(20200917), and can be applied to
> mainline cleanly now.
>
> drivers/scsi/qla2xxx/qla_dfs.c | 68 ++++------------------------------
> 1 file changed, 8 insertions(+), 60 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
> index e62b21152..9e49b47f6 100644
> --- a/drivers/scsi/qla2xxx/qla_dfs.c
> +++ b/drivers/scsi/qla2xxx/qla_dfs.c
> @@ -37,20 +37,7 @@ qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused)
> return 0;
> }
>
> -static int
> -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,
> -};
> +DEFINE_SHOW_ATTRIBUTE(qla2x00_dfs_tgt_sess);
>
> static int
> qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
> @@ -106,20 +93,7 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
> return 0;
> }
>
> -static int
> -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,
> -};
> +DEFINE_SHOW_ATTRIBUTE(qla2x00_dfs_tgt_port_database);
>
> static int
> qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
> @@ -154,20 +128,7 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
> return 0;
> }
>
> -static int
> -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,
> -};
> +DEFINE_SHOW_ATTRIBUTE(qla_dfs_fw_resource_cnt);
>
> static int
> qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
> @@ -244,20 +205,7 @@ qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
> return 0;
> }
>
> -static int
> -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,
> -};
> +DEFINE_SHOW_ATTRIBUTE(qla_dfs_tgt_counters);
>
> static int
> qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
> @@ -459,19 +407,19 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha)
>
> create_nodes:
> 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_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",
> - 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,
> &dfs_fce_ops);
>
> 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))
> ha->tgt.dfs_naqp = debugfs_create_file("naqp",
> --
> 2.23.0
>
Nice cleanup.
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
--
Himanshu Madhani Oracle Linux Engineering
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next v2] scsi: qla2xxx: Convert to DEFINE_SHOW_ATTRIBUTE
2020-09-19 2:52 [PATCH -next v2] scsi: qla2xxx: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
2020-10-07 13:35 ` Himanshu Madhani
@ 2020-10-07 17:12 ` Arun Easi
2020-10-13 22:42 ` Martin K. Petersen
2 siblings, 0 replies; 5+ messages in thread
From: Arun Easi @ 2020-10-07 17:12 UTC (permalink / raw)
To: Qinglang Miao
Cc: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
Martin K. Petersen, linux-scsi, linux-kernel
On Fri, 18 Sep 2020, 7:52pm, Qinglang Miao wrote:
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
>
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> ---
> v2: based on linux-next(20200917), and can be applied to
> mainline cleanly now.
>
> drivers/scsi/qla2xxx/qla_dfs.c | 68 ++++------------------------------
> 1 file changed, 8 insertions(+), 60 deletions(-)
>
Looks good. Thanks Qinglang.
Regards,
-Arun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next v2] scsi: qla2xxx: Convert to DEFINE_SHOW_ATTRIBUTE
2020-10-07 13:35 ` Himanshu Madhani
@ 2020-10-08 2:24 ` Martin K. Petersen
0 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2020-10-08 2:24 UTC (permalink / raw)
To: Qinglang Miao
Cc: Himanshu Madhani, Nilesh Javali, GR-QLogic-Storage-Upstream,
James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel
>> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Applied to 5.10/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next v2] scsi: qla2xxx: Convert to DEFINE_SHOW_ATTRIBUTE
2020-09-19 2:52 [PATCH -next v2] scsi: qla2xxx: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
2020-10-07 13:35 ` Himanshu Madhani
2020-10-07 17:12 ` Arun Easi
@ 2020-10-13 22:42 ` Martin K. Petersen
2 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2020-10-13 22:42 UTC (permalink / raw)
To: GR-QLogic-Storage-Upstream, Nilesh Javali, Qinglang Miao,
James E.J. Bottomley
Cc: Martin K . Petersen, linux-kernel, linux-scsi
On Sat, 19 Sep 2020 10:52:02 +0800, Qinglang Miao wrote:
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Applied to 5.10/scsi-queue, thanks!
[1/1] scsi: qla2xxx: Convert to DEFINE_SHOW_ATTRIBUTE
https://git.kernel.org/mkp/scsi/c/5e7e6472eda9
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-13 22:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-19 2:52 [PATCH -next v2] scsi: qla2xxx: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
2020-10-07 13:35 ` Himanshu Madhani
2020-10-08 2:24 ` Martin K. Petersen
2020-10-07 17:12 ` Arun Easi
2020-10-13 22:42 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).