Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1777254imm; Wed, 16 May 2018 02:57:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrHhmbgNZqMAfb/5q5uEe01XJJvgA7Ife8u1l7O9cQRrpGXmRf7lR1PqKHL8rP0x+5CIAXX X-Received: by 2002:a63:3c56:: with SMTP id i22-v6mr140422pgn.309.1526464649797; Wed, 16 May 2018 02:57:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526464649; cv=none; d=google.com; s=arc-20160816; b=xxxQcgjCCLm09Npk1lLq+cM/fxcQ/StjnftUFnxlVgFARrzI1sIBuf93NR5+2Sg/sP 5tWGO11QaafSaTU6M2bahhD1SXBth0qzFuZsWFT0Wmiahde5Uvcmi+0tdH0+jhmK5b51 C2Xg6STa723tZpwZ9kLEGbyfMDnZzIOGUCQNdYQNRLXrVMkkRuywbhkRi7J6WmeoVyiu ZTum8ZROqpkuzMGNqx1kBGSvtVVD+GjmVUwe4uuRHPOIOW704ieGKTx6T3oKG5+e0kYD 7WB7SWwUEudzYEETbFe2i5b35u8gd9mR1QvwE3VEY0m0/PfVuMTIjqZTITJAeyCq2gjU VCmg== 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=ECA2CSGSEhAH8vQLcByGR0V9OF7u8Xt7NEwNmuSYeWw=; b=Mgifqh8ZodLuRXXnzw33UaZufEF+so8khIHfepKKIonn+poPUP5wywjVqhbpCHx4UY 4kGIT2Nkc543hjGUwBwsfEbiL6gT2eY0mkkTOPeIZaccABeDHCzbTH7SfAfMAwYfOWfj 59yYN2vtdyT7qNiFA+83cHJHLrtU3RHtr4k8QrQA+iZZYFh6OX79v5IuNM5EKV62j5eh 8DRxhQTV7qHSFAXFMdD4s3oHqHRd01mvMTHKZFBVnTu6/MvAYHWV5Bqn/pohd82my0bl u4Q3vyUu7RuKYrrtI8ZOYfhzrMvVv0UjUrTelIHZpj94/85mpcqiIaP3JfFpHeR/5OqR Gi4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ppxkhriO; 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 g10-v6si1812146pgq.302.2018.05.16.02.57.14; Wed, 16 May 2018 02:57:29 -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=ppxkhriO; 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 S1753267AbeEPJz7 (ORCPT + 99 others); Wed, 16 May 2018 05:55:59 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48246 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752628AbeEPJqd (ORCPT ); Wed, 16 May 2018 05:46:33 -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=ECA2CSGSEhAH8vQLcByGR0V9OF7u8Xt7NEwNmuSYeWw=; b=ppxkhriOd6jtwroDtaSn/m9iU 8bsrimxqCQUj+orU5nGSJh3fwPAHO8jg0v+gfEXA9fKf3UVZIZoHhI/li48wL2oMb24/IOuIRpTPr eZUCCMkJLZ1F3pJbCq1lRqBo8Dv/pCffXCfXIwIxmJCV8tIPBZZsxtWXoRjrUcKLVtaTpTpB4vlDt VNVrApJka9g5nFL5Mx0n5doEZJDtGh99dA6LdDhN2vyOhaxTA96qwSGQH0nyS8iJGFGJAkENlCzSR A4QrdVXfbSh9QEga6lILtdKb5eaHXYwne1ivI3xWdRd2MXI/TiRDK1C66NxFjAVM5PA1WX4c43inb DIEHz6Gpg==; 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 1fIt0G-0007p3-Of; Wed, 16 May 2018 09:45:49 +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 27/42] resource: switch to proc_create_seq_data Date: Wed, 16 May 2018 11:43:31 +0200 Message-Id: <20180516094346.20506-28-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 the root resource directly from the proc private data. Signed-off-by: Christoph Hellwig --- kernel/resource.c | 43 +++++-------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/kernel/resource.c b/kernel/resource.c index 2af6c03858b9..b589dda910b3 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -87,7 +87,7 @@ enum { MAX_IORES_LEVEL = 5 }; static void *r_start(struct seq_file *m, loff_t *pos) __acquires(resource_lock) { - struct resource *p = m->private; + struct resource *p = PDE_DATA(file_inode(m->file)); loff_t l = 0; read_lock(&resource_lock); for (p = p->child; p && l < *pos; p = r_next(m, p, &l)) @@ -103,7 +103,7 @@ static void r_stop(struct seq_file *m, void *v) static int r_show(struct seq_file *m, void *v) { - struct resource *root = m->private; + struct resource *root = PDE_DATA(file_inode(m->file)); struct resource *r = v, *p; unsigned long long start, end; int width = root->end < 0x10000 ? 4 : 8; @@ -135,44 +135,11 @@ static const struct seq_operations resource_op = { .show = r_show, }; -static int ioports_open(struct inode *inode, struct file *file) -{ - int res = seq_open(file, &resource_op); - if (!res) { - struct seq_file *m = file->private_data; - m->private = &ioport_resource; - } - return res; -} - -static int iomem_open(struct inode *inode, struct file *file) -{ - int res = seq_open(file, &resource_op); - if (!res) { - struct seq_file *m = file->private_data; - m->private = &iomem_resource; - } - return res; -} - -static const struct file_operations proc_ioports_operations = { - .open = ioports_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - -static const struct file_operations proc_iomem_operations = { - .open = iomem_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - static int __init ioresources_init(void) { - proc_create("ioports", 0, NULL, &proc_ioports_operations); - proc_create("iomem", 0, NULL, &proc_iomem_operations); + proc_create_seq_data("ioports", 0, NULL, &resource_op, + &ioport_resource); + proc_create_seq_data("iomem", 0, NULL, &resource_op, &iomem_resource); return 0; } __initcall(ioresources_init); -- 2.17.0