Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1055373ybh; Thu, 16 Jul 2020 01:44:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOTnT4NIHkEDKi6goam2vshCaGpmpVHn9RuAIuZWFAdkPHEIy7g6q94zfIJnnbcqGFyCBN X-Received: by 2002:a17:906:5f98:: with SMTP id a24mr2599122eju.241.1594889054149; Thu, 16 Jul 2020 01:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594889054; cv=none; d=google.com; s=arc-20160816; b=PradFZUNdHx7JtZXT6VfbGrW1keQtGvliwzbSA295HgX9vqeBwMwD1kqS5nffdqPH6 QpXl3COUC4ZVGl9PoE0ofG5tpWIE/JsaYnKg7O9C72LEr60VAXSnCcxk8/C10NL1wCBH cQgjdSy51V3ng5Gw+rzSar0hV2iaZdYYRe7EOz0yji93oFPMyhS3gmWkP1kD5SzFc5Ok G66naV15m4zR+eRIvM8W38vqIfYkMO2V1v4Ab7lJwvf3E37sTg9y2n7enFMPEgdSXh7U pPKbE1PO4iBIWFjLa2XOeJleps25k8lZcrpz8H4BDkPjL07JKicUAqTk1h6BljBE1E7h ICGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=pY9JDb1aiHqaMxh+WwRdYnU9MrEmaIIQ/GBKPwO3KGE=; b=TJqVr9aqPkgFt3Ga1tQwWzsfj+9HY9d3JeJ69cddde6eJ0LlOEkxxyPxElOJF3v0BF aq/80pWCYYtCkImFNVK7bu6kw7GdBEwQo9UBNVmOsINfomFbynKSySp5sYMhv+aGD5tq f4lKGT3HGfXh5KjxzWx5XP/kndl6NmJYM46OVwmgluU1NwpZrmwGPuUt49zmjqQ/m6tc 87sM/NbhQO41KUfBiLnkqvRDn0YBXEKtV1Ln9xlCEZ+Xst7FI2QRVEu1sJISa2efC6Pc TkrfsKnU00CHQr65Z8xSPILHVMFTawvr2aHsDFRVXxopRSi2KGkqUGuwRqNwMy45lz/5 G2rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g12si2936638edv.266.2020.07.16.01.43.51; Thu, 16 Jul 2020 01:44:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727935AbgGPInk (ORCPT + 99 others); Thu, 16 Jul 2020 04:43:40 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:50788 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725897AbgGPInj (ORCPT ); Thu, 16 Jul 2020 04:43:39 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id CD134B3AD82296992FC9; Thu, 16 Jul 2020 16:43:29 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Thu, 16 Jul 2020 16:43:20 +0800 From: Qinglang Miao To: Greg Kroah-Hartman , John Garry CC: , Subject: [PATCH -next] scsi: hisi_sas: Convert to DEFINE_SHOW_ATTRIBUTE Date: Thu, 16 Jul 2020 16:47:14 +0800 Message-ID: <20200716084714.7872-1-miaoqinglang@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yongqiang Liu Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yongqiang Liu --- 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); static int hisi_sas_debugfs_axi_show(struct seq_file *s, void *p) { @@ -2897,19 +2885,7 @@ static int hisi_sas_debugfs_axi_show(struct seq_file *s, void *p) return 0; } -static int hisi_sas_debugfs_axi_open(struct inode *inode, struct file *filp) -{ - return single_open(filp, hisi_sas_debugfs_axi_show, - inode->i_private); -} - -static const struct file_operations hisi_sas_debugfs_axi_fops = { - .open = hisi_sas_debugfs_axi_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, - .owner = THIS_MODULE, -}; +DEFINE_SHOW_ATTRIBUTE(hisi_sas_debugfs_axi); static int hisi_sas_debugfs_ras_show(struct seq_file *s, void *p) { @@ -2924,19 +2900,7 @@ static int hisi_sas_debugfs_ras_show(struct seq_file *s, void *p) return 0; } -static int hisi_sas_debugfs_ras_open(struct inode *inode, struct file *filp) -{ - return single_open(filp, hisi_sas_debugfs_ras_show, - inode->i_private); -} - -static const struct file_operations hisi_sas_debugfs_ras_fops = { - .open = hisi_sas_debugfs_ras_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, - .owner = THIS_MODULE, -}; +DEFINE_SHOW_ATTRIBUTE(hisi_sas_debugfs_ras); static int hisi_sas_debugfs_port_show(struct seq_file *s, void *p) { @@ -2951,18 +2915,7 @@ static int hisi_sas_debugfs_port_show(struct seq_file *s, void *p) return 0; } -static int hisi_sas_debugfs_port_open(struct inode *inode, struct file *filp) -{ - return single_open(filp, hisi_sas_debugfs_port_show, inode->i_private); -} - -static const struct file_operations hisi_sas_debugfs_port_fops = { - .open = hisi_sas_debugfs_port_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, - .owner = THIS_MODULE, -}; +DEFINE_SHOW_ATTRIBUTE(hisi_sas_debugfs_port); static void hisi_sas_show_row_64(struct seq_file *s, int index, int sz, __le64 *ptr) @@ -3019,18 +2972,7 @@ static int hisi_sas_debugfs_cq_show(struct seq_file *s, void *p) return 0; } -static int hisi_sas_debugfs_cq_open(struct inode *inode, struct file *filp) -{ - return single_open(filp, hisi_sas_debugfs_cq_show, inode->i_private); -} - -static const struct file_operations hisi_sas_debugfs_cq_fops = { - .open = hisi_sas_debugfs_cq_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, - .owner = THIS_MODULE, -}; +DEFINE_SHOW_ATTRIBUTE(hisi_sas_debugfs_cq); static void hisi_sas_dq_show_slot(struct seq_file *s, int slot, void *dq_ptr) { @@ -3052,18 +2994,7 @@ static int hisi_sas_debugfs_dq_show(struct seq_file *s, void *p) return 0; } -static int hisi_sas_debugfs_dq_open(struct inode *inode, struct file *filp) -{ - return single_open(filp, hisi_sas_debugfs_dq_show, inode->i_private); -} - -static const struct file_operations hisi_sas_debugfs_dq_fops = { - .open = hisi_sas_debugfs_dq_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, - .owner = THIS_MODULE, -}; +DEFINE_SHOW_ATTRIBUTE(hisi_sas_debugfs_dq); static int hisi_sas_debugfs_iost_show(struct seq_file *s, void *p) { @@ -3080,18 +3011,7 @@ static int hisi_sas_debugfs_iost_show(struct seq_file *s, void *p) return 0; } -static int hisi_sas_debugfs_iost_open(struct inode *inode, struct file *filp) -{ - return single_open(filp, hisi_sas_debugfs_iost_show, inode->i_private); -} - -static const struct file_operations hisi_sas_debugfs_iost_fops = { - .open = hisi_sas_debugfs_iost_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, - .owner = THIS_MODULE, -}; +DEFINE_SHOW_ATTRIBUTE(hisi_sas_debugfs_iost); static int hisi_sas_debugfs_iost_cache_show(struct seq_file *s, void *p) { @@ -3117,20 +3037,7 @@ static int hisi_sas_debugfs_iost_cache_show(struct seq_file *s, void *p) return 0; } -static int hisi_sas_debugfs_iost_cache_open(struct inode *inode, - struct file *filp) -{ - return single_open(filp, hisi_sas_debugfs_iost_cache_show, - inode->i_private); -} - -static const struct file_operations hisi_sas_debugfs_iost_cache_fops = { - .open = hisi_sas_debugfs_iost_cache_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, - .owner = THIS_MODULE, -}; +DEFINE_SHOW_ATTRIBUTE(hisi_sas_debugfs_iost_cache); static int hisi_sas_debugfs_itct_show(struct seq_file *s, void *p) { @@ -3147,18 +3054,7 @@ static int hisi_sas_debugfs_itct_show(struct seq_file *s, void *p) return 0; } -static int hisi_sas_debugfs_itct_open(struct inode *inode, struct file *filp) -{ - return single_open(filp, hisi_sas_debugfs_itct_show, inode->i_private); -} - -static const struct file_operations hisi_sas_debugfs_itct_fops = { - .open = hisi_sas_debugfs_itct_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, - .owner = THIS_MODULE, -}; +DEFINE_SHOW_ATTRIBUTE(hisi_sas_debugfs_itct); static int hisi_sas_debugfs_itct_cache_show(struct seq_file *s, void *p) { @@ -3184,20 +3080,7 @@ static int hisi_sas_debugfs_itct_cache_show(struct seq_file *s, void *p) return 0; } -static int hisi_sas_debugfs_itct_cache_open(struct inode *inode, - struct file *filp) -{ - return single_open(filp, hisi_sas_debugfs_itct_cache_show, - inode->i_private); -} - -static const struct file_operations hisi_sas_debugfs_itct_cache_fops = { - .open = hisi_sas_debugfs_itct_cache_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, - .owner = THIS_MODULE, -}; +DEFINE_SHOW_ATTRIBUTE(hisi_sas_debugfs_itct_cache); static void hisi_sas_debugfs_create_files(struct hisi_hba *hisi_hba) { -- 2.17.1