Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2365594imm; Tue, 10 Jul 2018 19:24:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfRqjnf4xUjr1BW6wuf9mBU6cPWJz7cldqZZsBjsNj24q9jnllV2OohLAneOrFnzrfRuTOq X-Received: by 2002:a17:902:88:: with SMTP id a8-v6mr26381450pla.156.1531275892782; Tue, 10 Jul 2018 19:24:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531275892; cv=none; d=google.com; s=arc-20160816; b=MnzZ5LVhTkF67ZV5nB+ccYJeyiCOL5tuULtRwF4beLogj03b7Ax2Wuso/tFfa6Wf6g 465AkY3lfR2cGuQcaiPiBBxiijxjCCONP84vLCu4nPTeIB1WX2mdl30JtqFu9gUzGrvJ JCyG5sBCnyHKKVgH/ywHGgQAoPo+JraewfN3TlpvkCQOHLuWYpOvL2jmTmxXyeXYZoyn YX2utg4k4mRMlY/2MsRSuoUxBjNUT/L4d5VdTSf6SxpzDG2F0X5ywVeYi0EcZRFqaaKI lNM93IRsNb1+pB8bnoNZtralahraVL5dPWbe0wlZL0/4ka6jDr1HPo8vSIu7Es30TjnZ cAaw== 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:arc-authentication-results; bh=72F4vbJ6nDOQvMyoC6+mw26GX7kGZZfUZRme/eEdRLs=; b=ehyOT6OrX9QhVero3JWXjHT2G/2OyBQRwUvurI+umvY6mfBIfjAxtX4SfDlHZ2Zikr xxRGj7+au0zWyDxke74wwaIscxNOMuCevFFoGXtDrNv9xUMiAHDqctjLjx1sOTvERM1W lWhoQAVwmBRvVJgcSIDunSHU6VWkpPH5AaMDwa1FQuBs8+y0IEnX/eR06mVOyp4D8SZw q+N1uhac+DEZyno0brChmujeBrglTVU8hLm+HbbQpv6dnNyGnF2qeocNdXBnLxywWJ1o IxbZ7Xwvc9wmDeuRQkZIUGg9MT9LkJ5KsNbDN3AJCJwxWV2iATTL6b6QQXUPfEWc7DA1 CTVg== ARC-Authentication-Results: i=1; mx.google.com; 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 y34-v6si18279550plb.17.2018.07.10.19.24.37; Tue, 10 Jul 2018 19:24:52 -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; 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 S1732769AbeGKCZW (ORCPT + 99 others); Tue, 10 Jul 2018 22:25:22 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:45682 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732536AbeGKCYH (ORCPT ); Tue, 10 Jul 2018 22:24:07 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fd4ld-0003Kt-Sd; Wed, 11 Jul 2018 02:22:10 +0000 From: Al Viro To: Linus Torvalds Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Miklos Szeredi Subject: [RFC][PATCH 32/42] ocxlflash_getfile(): switch to alloc_file_pseudo() Date: Wed, 11 Jul 2018 03:21:56 +0100 Message-Id: <20180711022206.12571-32-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180711022206.12571-1-viro@ZenIV.linux.org.uk> References: <20180711021136.GN30522@ZenIV.linux.org.uk> <20180711022206.12571-1-viro@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Signed-off-by: Al Viro --- drivers/scsi/cxlflash/ocxl_hw.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c index 497a68389461..6d0632174ec6 100644 --- a/drivers/scsi/cxlflash/ocxl_hw.c +++ b/drivers/scsi/cxlflash/ocxl_hw.c @@ -88,10 +88,8 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name, const struct file_operations *fops, void *priv, int flags) { - struct qstr this; - struct path path; struct file *file; - struct inode *inode = NULL; + struct inode *inode; int rc; if (fops->owner && !try_module_get(fops->owner)) { @@ -116,26 +114,13 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name, goto err3; } - this.name = name; - this.len = strlen(name); - this.hash = 0; - path.dentry = d_alloc_pseudo(ocxlflash_vfs_mount->mnt_sb, &this); - if (!path.dentry) { - dev_err(dev, "%s: d_alloc_pseudo failed\n", __func__); - rc = -ENOMEM; - goto err4; - } - - path.mnt = mntget(ocxlflash_vfs_mount); - d_instantiate(path.dentry, inode); - - file = alloc_file(&path, OPEN_FMODE(flags), fops); + file = alloc_file_pseudo(inode, ocxlflash_vfs_mount, name, + OPEN_FMODE(flags), fops); if (IS_ERR(file)) { rc = PTR_ERR(file); dev_err(dev, "%s: alloc_file failed rc=%d\n", __func__, rc); - path_put(&path); - goto err3; + goto err4; } file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); -- 2.11.0