Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp157362ybj; Fri, 8 May 2020 08:39:50 -0700 (PDT) X-Google-Smtp-Source: APiQypJBMqL95XQtd/81tg4Gyn+6o9kK3+lK6if2H3dHbgLpuJKNGIkSrFmpBSE+ED5NUDu1G1kh X-Received: by 2002:aa7:d718:: with SMTP id t24mr2705470edq.29.1588952390774; Fri, 08 May 2020 08:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588952390; cv=none; d=google.com; s=arc-20160816; b=Pp2W+DWdyxdnhQri79j+XGM/Qs03c2m7qHO2JDuMIKLsWnzHaf7OIppZ1C7V0MshpS Cj1K4+RJ07ulNbQNKmEJbHwFFDd4B5KmclDVvBmeXFoe0uzG7RwdYTGin8ZZV5fKTER7 SEaaaAhvVSUT7q2DjkcUQNLRqUzOgcyArsdD9SBjcs1+aU01uL7YoBSpCs7ZfIfzpDZQ Ajc1JGRBgS4IIMfUrhC4jfHwEI+dDxGo2wpPSSd1BjeEWPwqtn3j4CFl6XaZSLYvT2Xl PC8lWaCNZ+Rt1Z3KU9xa9c7R9Ik1S57ehV2UdLzEcGvJ8y0cAyWRTzwlIR8x2+g/9BGY WyFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=o2cUHvSZE2EbFXmmDO+7qFHMKjG62hLvo4GWWJeNlEI=; b=FGTjiNyv3whMOQ0vi/Og/r+t1VZeKOYWbuyLRBoqig0OY+HxmzvJD8UOa8Iq9/Ebm6 DdpdCT5lMAxPcfx7nosSFvVnNZZvpufuDkIQnKu6g+Me472AEpQ9l4H2/MswkpmAsxGq rvmqxCaz35VMAiVPtwKNq5KzBrb5KEsly9FhNHQyOHstOqNoqm1Xl0P60K1TZ1dqitSa Emuc61jywUAV8HFhSxzTINtr2QX0vPISpMshHTZEKHwoPQDMUtGKGVxnmwG+q8y14YRM H5A1zTQekWetCBFMIVcbwL8WKs4y5VDSD/lkaZwiAM9OMqylYfQa8+Dh4TyMFM9ql0Xo lOhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GEun4DGR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si1099261ejs.290.2020.05.08.08.39.28; Fri, 08 May 2020 08:39:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GEun4DGR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728512AbgEHPhg (ORCPT + 99 others); Fri, 8 May 2020 11:37:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728373AbgEHPhF (ORCPT ); Fri, 8 May 2020 11:37:05 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D447C061A0C; Fri, 8 May 2020 08:37:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=o2cUHvSZE2EbFXmmDO+7qFHMKjG62hLvo4GWWJeNlEI=; b=GEun4DGRcmfYQBOvAkSWSKBi8k hyxwpEVsIDW42KAYGD2IG0DBW+naURQPn+t9000Tcky8+RFVAtsEdZQX53snjhIgZGF1c63t/IYif RvEWHwHOScnhB1KsKDEJS554BZrnYNEgfwKy8iUVdPkSRAHRXakiHI2Hm9rO+gNqibOnH05EqkW4U QbC29MaYTQ8PfMqDDc+fnAEXz4DIo1+rtG6TFmnP7+0r0O5H3HP9m74GFinmTv/XezxrDk4NZk9q+ xjD/XRPYCLfIpl8OCBt3vIyiGgdyGXi2kJrYnLXrIhyv6HxtF6+9PEkeWLESGyC4ENeK7Kl9FUULM yItqzyPQ==; Received: from [2001:4bb8:180:9d3f:90d7:9df8:7cd:3504] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jX53h-0004R3-4P; Fri, 08 May 2020 15:37:05 +0000 From: Christoph Hellwig To: Alexander Viro Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 10/12] drm_syncobj: use __anon_inode_getfd Date: Fri, 8 May 2020 17:36:32 +0200 Message-Id: <20200508153634.249933-11-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508153634.249933-1-hch@lst.de> References: <20200508153634.249933-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Use __anon_inode_getfd instead of opencoding the logic using get_unused_fd_flags + anon_inode_getfile. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/drm_syncobj.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 42d46414f7679..b69a7be34e8c7 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -581,18 +581,11 @@ int drm_syncobj_get_fd(struct drm_syncobj *syncobj, int *p_fd) struct file *file; int fd; - fd = get_unused_fd_flags(O_CLOEXEC); + fd = __anon_inode_getfd("syncobj_file", &drm_syncobj_file_fops, + syncobj, O_CLOEXEC, &file); if (fd < 0) return fd; - file = anon_inode_getfile("syncobj_file", - &drm_syncobj_file_fops, - syncobj, 0); - if (IS_ERR(file)) { - put_unused_fd(fd); - return PTR_ERR(file); - } - drm_syncobj_get(syncobj); fd_install(fd, file); -- 2.26.2