From patchwork Mon Feb 11 05:09:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 10805105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 52BD913A4 for ; Mon, 11 Feb 2019 05:10:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32C4F271CB for ; Mon, 11 Feb 2019 05:10:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 209D0297AD; Mon, 11 Feb 2019 05:10:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C72A4271CB for ; Mon, 11 Feb 2019 05:10:09 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 186A021F4E1; Sun, 10 Feb 2019 21:10:09 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id A875121F4BD for ; Sun, 10 Feb 2019 21:10:06 -0800 (PST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7A618ACE6; Mon, 11 Feb 2019 05:10:05 +0000 (UTC) From: NeilBrown To: James Simmons Date: Mon, 11 Feb 2019 16:09:58 +1100 In-Reply-To: <87tvhagbpl.fsf@notabene.neil.brown.name> References: <154949776249.10620.1215070753973826063.stgit@noble.brown> <154949781334.10620.18347323437724979128.stgit@noble.brown> <87tvhagbpl.fsf@notabene.neil.brown.name> Message-ID: <87r2cegbbt.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Subject: [lustre-devel] [PATCH] lustre: don't manage module refs in obd_class_open/close. X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" X-Virus-Scanned: ClamAV using ClamSMTP Core Linux code for managed char-devs ensures that the relevant module is held active which a char-dev is open - see cdev_get() and cdev_put(). So there is no need for lustre/obd_class to manage the module ref count as well. As this is all that obd_class_open and obd_class_close do, those functions can be removed. Signed-off-by: NeilBrown Reviewed-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/class_obd.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 84c077ec0116..b8fc74044fe3 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -544,20 +544,6 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) return err; } /* class_handle_ioctl */ -/* opening /dev/obd */ -static int obd_class_open(struct inode *inode, struct file *file) -{ - try_module_get(THIS_MODULE); - return 0; -} - -/* closing /dev/obd */ -static int obd_class_release(struct inode *inode, struct file *file) -{ - module_put(THIS_MODULE); - return 0; -} - /* to control /dev/obd */ static long obd_class_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) @@ -575,9 +561,7 @@ static long obd_class_ioctl(struct file *filp, unsigned int cmd, /* declare character device */ static const struct file_operations obd_psdev_fops = { .owner = THIS_MODULE, - .unlocked_ioctl = obd_class_ioctl, /* unlocked_ioctl */ - .open = obd_class_open, /* open */ - .release = obd_class_release, /* release */ + .unlocked_ioctl = obd_class_ioctl, }; /* modules setup */