Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp35681pxk; Tue, 15 Sep 2020 19:31:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhubbak9li/1w/Zs1/9R57xtj2l3DrU6yGlTayhQMFXNkXDaQexUgJDJZGKTBDt6e1dmMn X-Received: by 2002:a50:fb98:: with SMTP id e24mr24999026edq.130.1600223477705; Tue, 15 Sep 2020 19:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600223477; cv=none; d=google.com; s=arc-20160816; b=OcqrbhdItxfQ9RwYOKUJ0OJOIELdoV474z5wbPjxFtkyQ59b+x9EoX06w/Pg+qXTQJ Em5G2qJ/uBlAxJ/j1EZPsnbbqcYvSOqBFu5nGLpab4iuUxuxJraXJ4uXj5l/nukis88d WZ09ileDJAbdj9XXNfb1j/KE8WD6vOOEXqz0v66P+UmwpeZz9jRU5UGRCTQHrOk48a49 Snb/jGdkJPzAuyhhIT2PwlfyW0ayru/HQLrvQdXosypR8f2hgBISv/dFiQzFwMRt1vYf i/KN9dahuge07JdD+IsxENMfkjuuo3RdUtupeq3tqssmXp/6+bkVj4n0p67hSzVnGn5+ gYuA== 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=hrMI4GeCP8gpjKV2LElAEMEqQGrOViZXljVMkl4QtDE=; b=SK63tAwfg36MCKkVEUfTwbMfBTygHp1gXTqLA4mPQxcO9eEWDn3VTgIMYZLf7DJ3YL /LTBskf9lBFPWlfUad1umYLDJfwjjQA+zcUgvhFMcXUZRbB2G24ZT+gWqu0O0Q1N9Lp2 LQj5he65EeY8t+i1eZhp4MHPUgQtGf4szVL5Clj8z+9N+cMaOmmKXUPMMTO9ueNoEkFr pMMDXyrajvvVGjMQMVmrMY58QJrjbXMaFA0Z5mIOPLdiR7/QEFZXA5LXoVmvlbFCJMAN Re6CMsGpxfvertaxHqKAg6XDWxEqVYiKHcE+tr0pZb5ATlxgrRE9fa/jNgyNdqyTtqjl qhsg== 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 v13si10549169eja.325.2020.09.15.19.30.55; Tue, 15 Sep 2020 19:31:17 -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 S1726547AbgIPC31 (ORCPT + 99 others); Tue, 15 Sep 2020 22:29:27 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:57816 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726394AbgIPC14 (ORCPT ); Tue, 15 Sep 2020 22:27:56 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 75EA3D67445B38ACBA36; Wed, 16 Sep 2020 10:27:54 +0800 (CST) Received: from huawei.com (10.175.113.32) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Wed, 16 Sep 2020 10:27:46 +0800 From: Liu Shixin To: Doug Ledford , Jason Gunthorpe CC: , , Liu Shixin Subject: [PATCH -next] infiniband: ipoib: convert to use DEFINE_SEQ_ATTRIBUTE macro Date: Wed, 16 Sep 2020 10:50:22 +0800 Message-ID: <20200916025022.3992627-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.32] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code. Signed-off-by: Liu Shixin --- drivers/infiniband/ulp/ipoib/ipoib_fs.c | 50 ++----------------------- 1 file changed, 4 insertions(+), 46 deletions(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_fs.c b/drivers/infiniband/ulp/ipoib/ipoib_fs.c index 64c19f6fa931..12ba7a0fe0b5 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_fs.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_fs.c @@ -124,35 +124,14 @@ static int ipoib_mcg_seq_show(struct seq_file *file, void *iter_ptr) return 0; } -static const struct seq_operations ipoib_mcg_seq_ops = { +static const struct seq_operations ipoib_mcg_sops = { .start = ipoib_mcg_seq_start, .next = ipoib_mcg_seq_next, .stop = ipoib_mcg_seq_stop, .show = ipoib_mcg_seq_show, }; -static int ipoib_mcg_open(struct inode *inode, struct file *file) -{ - struct seq_file *seq; - int ret; - - ret = seq_open(file, &ipoib_mcg_seq_ops); - if (ret) - return ret; - - seq = file->private_data; - seq->private = inode->i_private; - - return 0; -} - -static const struct file_operations ipoib_mcg_fops = { - .owner = THIS_MODULE, - .open = ipoib_mcg_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release -}; +DEFINE_SEQ_ATTRIBUTE(ipoib_mcg); static void *ipoib_path_seq_start(struct seq_file *file, loff_t *pos) { @@ -229,35 +208,14 @@ static int ipoib_path_seq_show(struct seq_file *file, void *iter_ptr) return 0; } -static const struct seq_operations ipoib_path_seq_ops = { +static const struct seq_operations ipoib_path_sops = { .start = ipoib_path_seq_start, .next = ipoib_path_seq_next, .stop = ipoib_path_seq_stop, .show = ipoib_path_seq_show, }; -static int ipoib_path_open(struct inode *inode, struct file *file) -{ - struct seq_file *seq; - int ret; - - ret = seq_open(file, &ipoib_path_seq_ops); - if (ret) - return ret; - - seq = file->private_data; - seq->private = inode->i_private; - - return 0; -} - -static const struct file_operations ipoib_path_fops = { - .owner = THIS_MODULE, - .open = ipoib_path_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release -}; +DEFINE_SEQ_ATTRIBUTE(ipoib_path); void ipoib_create_debug_files(struct net_device *dev) { -- 2.25.1