Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp144814pxb; Wed, 11 Nov 2020 23:11:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJysTdVrbocieOG1WcHwytp6A46+weC4Aim4akX9t88L1jlYFzh5TLccF88KYvkKxNP9/pRd X-Received: by 2002:a17:906:6d52:: with SMTP id a18mr28305255ejt.224.1605165080200; Wed, 11 Nov 2020 23:11:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605165080; cv=none; d=google.com; s=arc-20160816; b=03cFVicKlfvCcbfle/MwxAgtv+xzLZ/osgDS5DATG1AVN3aDeVCj4KzGCke536DRrG ONe6/P/sbzGaJYiCke/BqPRdRJWZf3kXbmALvRTlMnSDDAAqDYjUWBJDZiZ3N0p1suJz ajMUCthxwb6kyMucC8Zb0AMYB4yNaQMh0OIeCJkRL7WTIdcSDdvp1Ts+GARYgUZbgCSk ZgVxv406B/761/WPwE0zYibBWNrRG4ALf3NYBYWL4JmEqCfONxHcm5Jmgno0LLdAMbyh 1aWiRQla7oxw5wlPrj16+nWOQG94JXmrd9S1LYCj1ZyTT3UIL6WOkSQ85OrDEG36knDw hhCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=AidgXXMz4BMYifMvmmCqhG4QFCM5LfpUcx33jJiUfys=; b=cY9kjbelONGaOY4Vb8GBSovoBMkvDVeYTAQllf661hpFK1rFaPqOjZp8RIb/Rq4e1N rhM0EKDK2jQwPr+GJ0hBO3NRY/SrQTrj44mTwUH6a7cr9iGE2gzuOP2ZRW4OeYouq/wU Tp9mDWCUDOFFDhNmrHcx5drm3mUIxoftjnhbAM9Rl/+xsGA0AmpcVuAQBmbWayHWUyt2 rITn8nnjtUG/dHUjTwkcSqbYWfPxQ3zI40PrBeaN8vWfJArIGzfkZUkw4XamfeFDDmp7 6rfZnwiR0RG51xNZjbbF2H2zfl8PkOZZuZVexJ1sUkAxE8MYi5xwiuoKguD13ojkfcYB 7l4w== 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 bo5si3225542ejb.102.2020.11.11.23.10.55; Wed, 11 Nov 2020 23:11:20 -0800 (PST) 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 S1726219AbgKLHHa (ORCPT + 99 others); Thu, 12 Nov 2020 02:07:30 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:7519 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbgKLHH3 (ORCPT ); Thu, 12 Nov 2020 02:07:29 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CWt2V0hCyzhkl1; Thu, 12 Nov 2020 15:07:14 +0800 (CST) Received: from huawei.com (10.69.192.56) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Thu, 12 Nov 2020 15:07:15 +0800 From: Luo Jiaxing To: , , CC: , , , , , , , , , , , Subject: [PATCH v4 3/5] scsi: qla2xxx: Introduce DEFINE_SHOW_STORE_ATTRIBUTE for debugfs Date: Thu, 12 Nov 2020 15:07:41 +0800 Message-ID: <1605164864-58944-4-git-send-email-luojiaxing@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1605164864-58944-1-git-send-email-luojiaxing@huawei.com> References: <1605164864-58944-1-git-send-email-luojiaxing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/scsi/qla2xxx/qla_dfs.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index f89ad32..a5de808 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -513,14 +513,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) @@ -569,14 +561,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) @@ -622,7 +607,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"); -- 2.7.4