Re: [PATCH -next] scsi: hisi_sas: Convert to DEFINE_SHOW_ATTRIBUTE

From: miaoqinglang
Date: Thu Jul 16 2020 - 09:04:31 EST



å 2020/7/16 17:25, John Garry åé:
On 16/07/2020 09:47, Qinglang Miao wrote:

Not sure why you cc Greg, but SCSI maintainers should have been - James and Martin

From: Yongqiang Liu <liuyongqiang13@xxxxxxxxxx>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yongqiang Liu <liuyongqiang13@xxxxxxxxxx>

The sender is not the author, so your signed-off-by should also be here (after sign off from Yongqiang Liu)

Sorry for not knowing this rule, I will send a new patch later on if you don't mind.
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 137 ++------------------------
 1 file changed, 10 insertions(+), 127 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 852d2620e..f50b0c78f 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -2870,19 +2870,7 @@ static int hisi_sas_debugfs_global_show(struct seq_file *s, void *p)
ÂÂÂÂÂ return 0;
 }
 -static int hisi_sas_debugfs_global_open(struct inode *inode, struct file *filp)
-{
-ÂÂÂ return single_open(filp, hisi_sas_debugfs_global_show,
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ inode->i_private);
-}
-
-static const struct file_operations hisi_sas_debugfs_global_fops = {
-ÂÂÂ .open = hisi_sas_debugfs_global_open,
-ÂÂÂ .read_iter = seq_read_iter,
-ÂÂÂ .llseek = seq_lseek,
-ÂÂÂ .release = single_release,
-ÂÂÂ .owner = THIS_MODULE,
-};
+DEFINE_SHOW_ATTRIBUTE(hisi_sas_debugfs_global);

I couldn't see an equivalent for file_operations which have a read and write method, and the driver has a few of those.
Yes, you're right. There's no equivalence when drivers have read and write method. So the file_operations we cleaned up are those without write method, like hisi_sas_debugfs_global_fops.

Thanks
.
Thanks
Â.