Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1778167imm; Wed, 16 May 2018 02:58:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqg3zUmB/FEB3sq8AjrfpEVONG2IwqZ90Mue1mvIp986WPnSy6zV6EVfr0g+zSB9xpMJ4SS X-Received: by 2002:a62:ee15:: with SMTP id e21-v6mr191543pfi.203.1526464721326; Wed, 16 May 2018 02:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526464721; cv=none; d=google.com; s=arc-20160816; b=wZY4uNEKKhZEeaYV9sCWQA/hq+mAtARlghbZ1dOTzeCjmaTOzUA2EYpHYSUZNS680l X/QUU8Ib7Eb2sqCgH3jt8nkYfY5eDyRxKQ5iztzoFoVM5PUOfiL3Ei0MBq/zMaVYQtgi NaZHC4fTmOrEivs1YedY/lNvrlccoBEtwhsZwnKdICogrz2TICanEzHCAY9SWpC+IPM4 BusuKEZjyK9QCvMdwq+lCebDHnW/+xAPTfYKeEakk7DmremWGBoX2eMvu/5Aq4mvmQ9i OivTelrZvA3+UhNvmP4Kq+6F2ZeGaEtQsN1w13DB5UtfKe5teS43istEqT52O/8UGVyV +l0Q== 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=ONCcJlcqxJ1Unnt/MM18l+Og8ZFxeDuMB5U51/JSgCE=; b=RDFffYKZp+bQhMwVex44S7y5XZn5MyqnThAvMBrZKtZP/+gwc4HsV8VNYrzBjs311q RDWsUUmUaKfHh+o1RMa7p9mhh7WATXOJtzlA9kYNylx/YYDSOrT3w2XSyCoQdkKiSt9E ECBVD98vQeQkKM/YntpD1bJzSeK2KK9zAFXlvPWdy6pRdp46tRdPK8L1WtmdUBLPi5hy HZZQfoLoTTTwN6V9E+7mvq4PvZ5SzVGsZeQCC+D+NR0dFIuRYaGCtIYs7AyaGjO12QA5 tkW5uQ+3coos+t7ic7ayeBfVVv8G3fvqaGp/iAtk8dQ9tin64zJq4cD9g+Mv6vAEKJxf +/mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EH4M09Gv; 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 p84-v6si2297988pfa.180.2018.05.16.02.58.27; Wed, 16 May 2018 02:58:41 -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=EH4M09Gv; 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 S1753089AbeEPJqL (ORCPT + 99 others); Wed, 16 May 2018 05:46:11 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:47992 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752407AbeEPJqI (ORCPT ); Wed, 16 May 2018 05:46:08 -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=ONCcJlcqxJ1Unnt/MM18l+Og8ZFxeDuMB5U51/JSgCE=; b=EH4M09GvheTPRyoP6W6O3d4hS JSDGmrKexY0qZfm4QcIcH1P5KgPklm7XG0lTygn+FJKAb1FuWtgcSRER6MQWiBp0oH8kfVh+dJj5K QPmB83Cs3yCmHDYtOvi/O+57jn9kbkFcRcb2HUA26torrlWetnvCt1m1HJbhTswRxoi6drmaN98Iy lU8u8JbTd98Ei+CYIusTbn8QUWAqKvJxBb5Xqnl3f/KNi3Hv+zovdIwSB3NYNFAeGaE7jt+GnXXFn lZVzFVNq1p3TszTNB6SRNBMWovtwdudCfWNx9kE0e4Th5CpkfOhbrdS0Rzt5oFVUR7P4qYDesquUp 1rbTY8Rsg==; 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 1fIt0K-0007rG-Kg; Wed, 16 May 2018 09:45:53 +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 28/42] drbd: switch to proc_create_single Date: Wed, 16 May 2018 11:43:32 +0200 Message-Id: <20180516094346.20506-29-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 stop messing with try_module_get on THIS_MODULE, which doesn't make any sense here. Signed-off-by: Christoph Hellwig --- drivers/block/drbd/drbd_int.h | 2 +- drivers/block/drbd/drbd_main.c | 3 ++- drivers/block/drbd/drbd_proc.c | 34 +--------------------------------- 3 files changed, 4 insertions(+), 35 deletions(-) diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 06ecee1b528e..461ddec04e7c 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h @@ -1643,7 +1643,7 @@ void drbd_bump_write_ordering(struct drbd_resource *resource, struct drbd_backin /* drbd_proc.c */ extern struct proc_dir_entry *drbd_proc; -extern const struct file_operations drbd_proc_fops; +int drbd_seq_show(struct seq_file *seq, void *v); /* drbd_actlog.c */ extern bool drbd_al_begin_io_prepare(struct drbd_device *device, struct drbd_interval *i); diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 185f1ef00a7c..c2d154faac02 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -3010,7 +3010,8 @@ static int __init drbd_init(void) goto fail; err = -ENOMEM; - drbd_proc = proc_create_data("drbd", S_IFREG | S_IRUGO , NULL, &drbd_proc_fops, NULL); + drbd_proc = proc_create_single("drbd", S_IFREG | S_IRUGO , NULL, + drbd_seq_show); if (!drbd_proc) { pr_err("unable to register proc file\n"); goto fail; diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c index 582caeb0de86..74ef29247bb5 100644 --- a/drivers/block/drbd/drbd_proc.c +++ b/drivers/block/drbd/drbd_proc.c @@ -33,18 +33,7 @@ #include #include "drbd_int.h" -static int drbd_proc_open(struct inode *inode, struct file *file); -static int drbd_proc_release(struct inode *inode, struct file *file); - - struct proc_dir_entry *drbd_proc; -const struct file_operations drbd_proc_fops = { - .owner = THIS_MODULE, - .open = drbd_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = drbd_proc_release, -}; static void seq_printf_with_thousands_grouping(struct seq_file *seq, long v) { @@ -235,7 +224,7 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se } } -static int drbd_seq_show(struct seq_file *seq, void *v) +int drbd_seq_show(struct seq_file *seq, void *v) { int i, prev_i = -1; const char *sn; @@ -345,24 +334,3 @@ static int drbd_seq_show(struct seq_file *seq, void *v) return 0; } - -static int drbd_proc_open(struct inode *inode, struct file *file) -{ - int err; - - if (try_module_get(THIS_MODULE)) { - err = single_open(file, drbd_seq_show, NULL); - if (err) - module_put(THIS_MODULE); - return err; - } - return -ENODEV; -} - -static int drbd_proc_release(struct inode *inode, struct file *file) -{ - module_put(THIS_MODULE); - return single_release(inode, file); -} - -/* PROC FS stuff end */ -- 2.17.0