Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1769458imm; Wed, 16 May 2018 02:48:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp1ijL+NYXPtpqisHyOq7Zb5I5WX4dzneizStslV2QitPwBJ6C6+olMJ8oFQa9O/L0CZE8I X-Received: by 2002:a17:902:5a88:: with SMTP id r8-v6mr214904pli.78.1526464123963; Wed, 16 May 2018 02:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526464123; cv=none; d=google.com; s=arc-20160816; b=hHOyeJy46fMAlzTuubRHyN1e0xoB2Hp1osVQf1oEK1f1PhR6qXair3juZ70fpDir1/ mLWQzcEtw3OX9ZaYMN8ZJbrUBzDs8fzdOzP/mYvsMxrWvAVbagHCPUhyaw378zrp8ExD iY90uDWum4y51MwvmtoKRMwMRVd+/qoZpEXE1vYxxvkWpUNeBrjSQA59b8EYKAJxClMg AyNksN8Cqw9mKPFPvG5jSejPIpWBNNgMrcIBmX1fWxdS0OGD3Kpt2rWodlKVjlVxPu4X Tr85uqtUVEi5L5D0bGO7LY1eHfWK84rrkAR8UXNCRRUiOIqNOhoO4VYz8bLu72/YFzDM wfGg== 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=IG61pFy4GkP3GnA8qp8UiJ1fXufhht5pH9kvurAP8uA=; b=lGIOzArl3z2FwyFwrzA3njNAWBwlkpUzgmJviFnYxCqRRNXqD7ghRPKLieJxxvCgmw UhPoSh7J9V9c5xHLk04roAuUDbggmEMpSTDcnr4P5S5OyImWCH69iZ7sLocOiHO76uLN aHlZIpBs50/p31U0ajYlGOO0emWwwix/D8hdsPdYm8eVaIvWL8raMXj/Oa9RGIVafVMq 7crf2pVo4LAznLQolKzldBwoILripXuNh4lwJzFONz+DM7Xbi/8+y+YqiMC3waecTqSo 8naOvf1PjdRzzYSez2LYtXv5d6Ad2uMazuej4DfqUSPpYkTVHb3GzFfzXmdIFFkgkBj+ yIsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=rPNoTs2T; 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 k26-v6si1753316pgf.522.2018.05.16.02.48.29; Wed, 16 May 2018 02:48:43 -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=rPNoTs2T; 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 S1753319AbeEPJrQ (ORCPT + 99 others); Wed, 16 May 2018 05:47:16 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48594 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753226AbeEPJrN (ORCPT ); Wed, 16 May 2018 05:47:13 -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=IG61pFy4GkP3GnA8qp8UiJ1fXufhht5pH9kvurAP8uA=; b=rPNoTs2TSTAz4DbaFA3PMnfY0 ivjgwV8DgJMypmOQ2Wi9w2A6Xqix1MTQd91878TrpdndQ7qRbo0dzLjNJ5jmCFxOrxq3q3PttYmQJ rE4imO61HKJBXXtmNy2VXJpkARTdJWok8WCA1z9StlatpnETfmePwKPVsGcsQ0Kxci6NJ1CxrxLS6 1c77oG/tzv3ri5rldHo4ARjSKVHclAKSFyZ3PmRoyhYlT2jnVV3r9oWlaAlfv7hDFHb3asIuR+460 k3Q320Ll2PtQTsMRiOqBhPn5GvHu/ZiAzRpoluYP1HKO4mnQNWEGbw1iYbGI/3DppR30D/uG9zo7h sIFXfKAAw==; 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 1fIt0n-0007yU-HX; Wed, 16 May 2018 09:46:22 +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 35/42] bluetooth: switch to proc_create_seq_data Date: Wed, 16 May 2018 11:43:39 +0200 Message-Id: <20180516094346.20506-36-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 and private state. Signed-off-by: Christoph Hellwig --- net/bluetooth/af_bluetooth.c | 40 +++++------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 84d92a077834..3264e1873219 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c @@ -605,15 +605,10 @@ int bt_sock_wait_ready(struct sock *sk, unsigned long flags) EXPORT_SYMBOL(bt_sock_wait_ready); #ifdef CONFIG_PROC_FS -struct bt_seq_state { - struct bt_sock_list *l; -}; - static void *bt_seq_start(struct seq_file *seq, loff_t *pos) __acquires(seq->private->l->lock) { - struct bt_seq_state *s = seq->private; - struct bt_sock_list *l = s->l; + struct bt_sock_list *l = PDE_DATA(file_inode(seq->file)); read_lock(&l->lock); return seq_hlist_start_head(&l->head, *pos); @@ -621,8 +616,7 @@ static void *bt_seq_start(struct seq_file *seq, loff_t *pos) static void *bt_seq_next(struct seq_file *seq, void *v, loff_t *pos) { - struct bt_seq_state *s = seq->private; - struct bt_sock_list *l = s->l; + struct bt_sock_list *l = PDE_DATA(file_inode(seq->file)); return seq_hlist_next(v, &l->head, pos); } @@ -630,16 +624,14 @@ static void *bt_seq_next(struct seq_file *seq, void *v, loff_t *pos) static void bt_seq_stop(struct seq_file *seq, void *v) __releases(seq->private->l->lock) { - struct bt_seq_state *s = seq->private; - struct bt_sock_list *l = s->l; + struct bt_sock_list *l = PDE_DATA(file_inode(seq->file)); read_unlock(&l->lock); } static int bt_seq_show(struct seq_file *seq, void *v) { - struct bt_seq_state *s = seq->private; - struct bt_sock_list *l = s->l; + struct bt_sock_list *l = PDE_DATA(file_inode(seq->file)); if (v == SEQ_START_TOKEN) { seq_puts(seq ,"sk RefCnt Rmem Wmem User Inode Parent"); @@ -681,35 +673,13 @@ static const struct seq_operations bt_seq_ops = { .show = bt_seq_show, }; -static int bt_seq_open(struct inode *inode, struct file *file) -{ - struct bt_sock_list *sk_list; - struct bt_seq_state *s; - - sk_list = PDE_DATA(inode); - s = __seq_open_private(file, &bt_seq_ops, - sizeof(struct bt_seq_state)); - if (!s) - return -ENOMEM; - - s->l = sk_list; - return 0; -} - -static const struct file_operations bt_fops = { - .open = bt_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release_private -}; - int bt_procfs_init(struct net *net, const char *name, struct bt_sock_list *sk_list, int (* seq_show)(struct seq_file *, void *)) { sk_list->custom_seq_show = seq_show; - if (!proc_create_data(name, 0, net->proc_net, &bt_fops, sk_list)) + if (!proc_create_seq_data(name, 0, net->proc_net, &bt_seq_ops, sk_list)) return -ENOMEM; return 0; } -- 2.17.0