Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1099181pxx; Fri, 30 Oct 2020 01:52:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDCmaE7gBNCVe0wv2gVxza/+E0ktBLa9LvGqtiXAKafyFJ/tSn4RPyPN8twH34GyCn6JaV X-Received: by 2002:a17:906:6d89:: with SMTP id h9mr1346408ejt.152.1604047932581; Fri, 30 Oct 2020 01:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604047932; cv=none; d=google.com; s=arc-20160816; b=NdSEcpmRTKGgRvlvcK+YRx2uE6tX5JieyfHTW9H9MYVjumzjBFD+cLOUmkGTN2z/Xy 8zrScmVN+nnbDICcGz05hzdyR2lCeXf49zC42AifJE8rm59aYm46f1SzpMWG+VyF99OH Zxw6mEpXiOkZk9GfOibtJhM50cpXchlu27U1Mtfms/bNMbYoezrOmH/Mp7STOE3L+FE/ jb9oYMSIGgqg3lLk2BzEThzxJvBu43PUKMA63Kl7Tt5HArofMvqr4rmqq0z9zTnqnmh/ +P2eGWwNTjXk8zu2N51WokoXRLA9xGzVSJdnatflHAGNWRXd2q/hhxqkeJzg+x1vWwrN HKfQ== 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=FgQmSpwBY0hZQjh1BiQFHBT6+upj6ccsj8IniIy+aAE=; b=qqnR4zsgzs4u4238cxkWCMAtQgwLRli/fOgFOh4bdP6NVZ0KjgQDFA61AGm7+7kOrw ieIKxqhjlIH+LtXxEq1DNovV2TgsO//dCtM9x7TrlZPij3924Yyz3bnYWfKrPiibML9A yKRuB0nR0k4G5qAlgXZp+pseieEGdrN4bb92PdWtSEODdgIm+wLTAq1C8QEUy611+oa4 kj0G1dLF565R7L98bOue4dwOQIg4P0TuQA+yrqeC3T5OqJ8ToKyWdECCwuWJQBncMkaR 86UbXNGifPU8E2L/CHNSGcDU1W67WOz9s7jCTsDjDgD6AZBZoMX76ihKH3PDaCFcTqxP K60Q== 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 yz13si3915004ejb.173.2020.10.30.01.51.50; Fri, 30 Oct 2020 01:52:12 -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 S1726190AbgJ3Iu3 (ORCPT + 99 others); Fri, 30 Oct 2020 04:50:29 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:7380 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726052AbgJ3Iu1 (ORCPT ); Fri, 30 Oct 2020 04:50:27 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4CMwWp1Vwcz70SZ; Fri, 30 Oct 2020 16:31:34 +0800 (CST) Received: from huawei.com (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Fri, 30 Oct 2020 16:31:25 +0800 From: Luo Jiaxing To: , , CC: , , , , , , , , , , , Subject: [PATCH v2 3/5] scsi: qla2xxx: Introduce DEFINE_SHOW_STORE_ATTRIBUTE for debugfs Date: Fri, 30 Oct 2020 16:32:00 +0800 Message-ID: <1604046722-15531-4-git-send-email-luojiaxing@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604046722-15531-1-git-send-email-luojiaxing@huawei.com> References: <1604046722-15531-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 instroduce a new helper marco DEFINE_SHOW_STORE_ATTRIBUTE for Read-Write file, So we apply it at qla2xxx to reduce some duplicate 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