Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp468074pxb; Tue, 3 Nov 2020 04:33:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAcnJIZiM1JhJjDhJ+CFF9ASeujOLmO4yjYCrqbx/OOIAsCbgLkUfiCcXs73/Eb1ykehrD X-Received: by 2002:aa7:cacd:: with SMTP id l13mr21225964edt.177.1604406798680; Tue, 03 Nov 2020 04:33:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604406798; cv=none; d=google.com; s=arc-20160816; b=wCjHKNECUlHtpGjwNyF2IZG1CutdahhwTU13vqLTl3YcKKxT0Y8XqT/D05ABw+41eV 13tThfIm+ZovdYSZpiG4Zjq8bmURvfk/O/fuSOq76lPyWqad45lELlNrdLPwIeSFteOH ylARykqT1dSYE5tswUF+c3rFGeAqwU6LTdlbOqvEOwNnLaVZ0NdzlEP1toglO7fCyx/q YpAx+D61PovcqAuEXIPVq0a/lcFdIrj1FF9YFfHjklKnzO/+Nz0tBomptr9aejicGM94 DJzxfxkFJ/9SZ48UaCqnJltUhMWnPg2sfpY8kLTcRGqwJFedszoT9jTeKMqQJUIF23gu NnLg== 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=xWc6CiUCMc9Z9H3LWqajA4EPNgtK3qPdQP/2etWvPWwCpI/XU1fVcHaz3T7zErMH7m uFy1/b7TJI/MUoD0M1yir36DW4R4IczrXW5QkiuXDjfsUMz784KSwbY82q6XR9ua7EvB FjpnVZ1F9DbUhsRUutn5gJkSIx+oDR2bIKyUVs82gWQjVFtNXuYa5M3Xbwpe515oA3pV /Z72Z/4jq8hU0k8WM6qHIyhmz2zBpeYEj8mrB29eUaQ6q6mCqfzM1WYJYOiLG5JB9p6L FgYAh6zLewLE8TfoIdrlJlB7cUfk8TqBpWEJOzSU/CXbkfaCf0YO9ErgN5/3jMQxMKwm EdDw== 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 h11si13058210edq.428.2020.11.03.04.32.54; Tue, 03 Nov 2020 04:33:18 -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 S1729046AbgKCM3X (ORCPT + 99 others); Tue, 3 Nov 2020 07:29:23 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:7584 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727923AbgKCM3W (ORCPT ); Tue, 3 Nov 2020 07:29:22 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CQTcB1qB7zLt6X; Tue, 3 Nov 2020 20:29:14 +0800 (CST) Received: from huawei.com (10.69.192.56) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Tue, 3 Nov 2020 20:29:10 +0800 From: Luo Jiaxing To: , , CC: , , , , , , , , , , , Subject: [PATCH v3 3/5] scsi: qla2xxx: Introduce DEFINE_SHOW_STORE_ATTRIBUTE for debugfs Date: Tue, 3 Nov 2020 20:29:42 +0800 Message-ID: <1604406584-53926-4-git-send-email-luojiaxing@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604406584-53926-1-git-send-email-luojiaxing@huawei.com> References: <1604406584-53926-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