Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1776210imm; Wed, 16 May 2018 02:56:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqDCK8tN1CtON9bNSH6xlEk02pBmgh9rhZwHd8RsMpmn0oOhZdOxGz2KXdloh7UYQb/lo0R X-Received: by 2002:a63:7d47:: with SMTP id m7-v6mr128390pgn.443.1526464564486; Wed, 16 May 2018 02:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526464564; cv=none; d=google.com; s=arc-20160816; b=dOGYSSOVptyjb4sPvUetjlEtHRv/zQU6bxJa9r5SmAAG4Rx8pBWRD7W8Dn3Ty0nCd4 lvYjoXafRLsgkM3NNFPaIr17NMGd31P3ROcBLX47zLH2cxs5AVrJossOCoHmBU/M1tvJ CsqsCZuzP9Pqp75yxzA6P/jndEZ1jCcgq7Y78lWgNQWo0Bv/+synHYbdumF249qUIrtA dhedr+egiNCvWBGv5X3pgiEtPBRmhz9SJgTGE/PYWyo/kdmSMzP7OrQp3ZDNuQDvnzNj ZY/Im/noEA3U3PriPNOcejijfCzXZsUZHCUeBVk5Oq6clEweOIdLbR61pQmEuwFW1/m7 6sFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Fxs1vB86YKtWq7jeY8OJ1X4ZOh0/9yrlTlsMzJNSCWo=; b=iH/zh7IIS7ruSLW/pRN2ZJvIUtZzZ5x43s8A+5iS+aV34LQpigQsZdUHxWjBNrCikF W0QcgNoHF9E7ysdd/EBE5XZlyeQx2hIFI/W6yBOtja1Akg7X7kMO1kZClw3z8v6bTvBy 0yrH+g/cMTucDUcM+blZAl/Ygug2Z8smy8png8YtWWFl78qEV3GZfTXiAYDzqI8OG0lT siw0ri4J/QBzJjBO4QCNyHesp09H0t4dl/488nACyQvJAnZzOIrQTboD5Idyo0vT4yM8 gdaXYnmVIFwpdLEUABEf6dElIb3KAKWgb10gVpj7k7jpaaVEntIv90m5hSEH8MIeLuMC +fVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=R1Q8wUz2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f64-v6si1986393plf.496.2018.05.16.02.55.50; Wed, 16 May 2018 02:56:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=R1Q8wUz2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753208AbeEPJqu (ORCPT + 99 others); Wed, 16 May 2018 05:46:50 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48384 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753198AbeEPJqq (ORCPT ); Wed, 16 May 2018 05:46:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Fxs1vB86YKtWq7jeY8OJ1X4ZOh0/9yrlTlsMzJNSCWo=; b=R1Q8wUz2TRJInluyXZ91H8tyD JRep7f1uGIhIkXucb1QjQXKkkrWW50RC7AKU1sQS5NuTmrypfDdVjrSBumdkgEQ0xGEo+JKLg3cGY nAGwBr/Zh6jmXAOQ+H133Xq7Z/O4IWdVAcdolZ/V5pSxnmsO1tQkqGQTaNDEEkeQEdF3chC5EWWlA 8a8bHMgoPpXIajqbUtP84Y1Aj3gqwKjN9ncVx/4LjcCccNNjCWmJcP/qQVazMvMicKsL+APBWbTnb d8luzXbpQ+/ssFQKCsDviJkMHK/EWxRUrgUKM6bXTs5CRKiLBPKMbeah+09QXMOeXmXxzmgqvoblN kBBtdPJow==; Received: from 089144199016.atnat0008.highway.a1.net ([89.144.199.16] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIt0S-0007tF-Pf; Wed, 16 May 2018 09:46:01 +0000 From: Christoph Hellwig To: Andrew Morton , Alexander Viro Cc: Alexey Dobriyan , Greg Kroah-Hartman , Jiri Slaby , Alessandro Zummo , Alexandre Belloni , linux-acpi@vger.kernel.org, drbd-dev@lists.linbit.com, linux-ide@vger.kernel.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, devel@driverdev.osuosl.org, linux-afs@lists.infradead.org, linux-ext4@vger.kernel.org, jfs-discussion@lists.sourceforge.net, netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 30/42] bonding: switch to proc_create_seq_data Date: Wed, 16 May 2018 11:43:34 +0200 Message-Id: <20180516094346.20506-31-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516094346.20506-1-hch@lst.de> References: <20180516094346.20506-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org And use proc private data directly instead of doing a detour through seq->private. Signed-off-by: Christoph Hellwig --- drivers/net/bonding/bond_procfs.c | 36 ++++++------------------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index 01059f1a7bca..9f7d83e827c3 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c @@ -10,7 +10,7 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) __acquires(RCU) { - struct bonding *bond = seq->private; + struct bonding *bond = PDE_DATA(file_inode(seq->file)); struct list_head *iter; struct slave *slave; loff_t off = 0; @@ -29,7 +29,7 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos) { - struct bonding *bond = seq->private; + struct bonding *bond = PDE_DATA(file_inode(seq->file)); struct list_head *iter; struct slave *slave; bool found = false; @@ -56,7 +56,7 @@ static void bond_info_seq_stop(struct seq_file *seq, void *v) static void bond_info_show_master(struct seq_file *seq) { - struct bonding *bond = seq->private; + struct bonding *bond = PDE_DATA(file_inode(seq->file)); const struct bond_opt_value *optval; struct slave *curr, *primary; int i; @@ -167,7 +167,7 @@ static void bond_info_show_master(struct seq_file *seq) static void bond_info_show_slave(struct seq_file *seq, const struct slave *slave) { - struct bonding *bond = seq->private; + struct bonding *bond = PDE_DATA(file_inode(seq->file)); seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); seq_printf(seq, "MII Status: %s\n", bond_slave_link_status(slave->link)); @@ -257,38 +257,14 @@ static const struct seq_operations bond_info_seq_ops = { .show = bond_info_seq_show, }; -static int bond_info_open(struct inode *inode, struct file *file) -{ - struct seq_file *seq; - int res; - - res = seq_open(file, &bond_info_seq_ops); - if (!res) { - /* recover the pointer buried in proc_dir_entry data */ - seq = file->private_data; - seq->private = PDE_DATA(inode); - } - - return res; -} - -static const struct file_operations bond_info_fops = { - .owner = THIS_MODULE, - .open = bond_info_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - void bond_create_proc_entry(struct bonding *bond) { struct net_device *bond_dev = bond->dev; struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id); if (bn->proc_dir) { - bond->proc_entry = proc_create_data(bond_dev->name, - 0444, bn->proc_dir, - &bond_info_fops, bond); + bond->proc_entry = proc_create_seq_data(bond_dev->name, 0444, + bn->proc_dir, &bond_info_seq_ops, bond); if (bond->proc_entry == NULL) netdev_warn(bond_dev, "Cannot create /proc/net/%s/%s\n", DRV_NAME, bond_dev->name); -- 2.17.0