From patchwork Tue Nov 26 01:10:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 11261267 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 00926138C for ; Tue, 26 Nov 2019 01:11:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD6972068F for ; Tue, 26 Nov 2019 01:11:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD6972068F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E64E96E1D5; Tue, 26 Nov 2019 01:11:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 95C746E1CD for ; Tue, 26 Nov 2019 01:11:27 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id e6so8084259pgi.11 for ; Mon, 25 Nov 2019 17:11:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CYXA6kZl83KUkaRjWD+JnO5e82OiZcDqxj3GwOxeRBY=; b=iqEH2cR4dJDe1GObdkyS0FD7aF3sKd4LjStKKRM2ODrRXcn4DRa9rPSe+w6sMEu2Jl yb7Iit8Hf8HtAN36W+2NqVBtd26z7DdyalM4LA8t6TQGysrN0iaH5HoBnKbUAkaeMPxz wPA16Lj/kBLl0bgbYu9jBVi01L+pYV6ELqDwOkVc0drAq1zqkJJwbwgnNxjuOpBxK/5f dFeCAlLYJPXtdqKZd0Svw0l4RG2PmO69C5RkkH41e1/G8YR+iWk5wnj1GyghUh+IatgY UTS/UMj0nc6n9q/p6VYQ3oLloe5c4LWA/koWK/qXG7+gw8j/cBNcJTm7r864At18XfIb Nx7Q== X-Gm-Message-State: APjAAAXUb3jkm0F4sl3D5xgQk3Kw4d3pLlMWK5ift7bsDnDP19KmK1T7 BEmVzN3tNjKTbTnzl1KhskFv4CT/Z54= X-Google-Smtp-Source: APXvYqzlyN/MCu+DrmSpqR7YLQUp4bzlhPY64TLP0MkSXLWhsf/u/1XCaFm0y1S9airAT5joPOJsbQ== X-Received: by 2002:a62:1454:: with SMTP id 81mr37846295pfu.86.1574730687027; Mon, 25 Nov 2019 17:11:27 -0800 (PST) Received: from gurchetansingh0.mtv.corp.google.com ([2620:15c:202:201:bc97:5740:52a7:6875]) by smtp.gmail.com with ESMTPSA id z10sm9672903pgg.39.2019.11.25.17.11.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Nov 2019 17:11:26 -0800 (PST) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/5] udmabuf: add a pointer to the miscdevice in dma-buf private data Date: Mon, 25 Nov 2019 17:10:54 -0800 Message-Id: <20191126011056.67928-3-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191126011056.67928-1-gurchetansingh@chromium.org> References: <20191126011056.67928-1-gurchetansingh@chromium.org> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CYXA6kZl83KUkaRjWD+JnO5e82OiZcDqxj3GwOxeRBY=; b=j7iti68QtnuSNuDgccVp4afXbu157fbYcx9OC/PLMkVz6Iq5pgNGbzZ1jGtJl3fOGk dzxTqhAtFVFmun2MK7Q98ovXuqklQZMTvFd7BM/DplHIMeousQKDHK2Gk0caEdV84S/Z t73z4ZdEibBRzwBx55nDIiGKQITUI4tYb4Oy8= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gurchetan Singh , kraxel@redhat.com, hch@lst.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Will be used later. v2: rename 'udmabuf_misc' to 'device' (kraxel) Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index ce9caaaa9e4b..9e6fdd2bc979 100644 --- a/drivers/dma-buf/udmabuf.c +++ b/drivers/dma-buf/udmabuf.c @@ -19,6 +19,7 @@ struct udmabuf { u32 flags; pgoff_t pagecount; struct page **pages; + struct miscdevice *device; }; static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf) @@ -127,8 +128,9 @@ static const struct dma_buf_ops udmabuf_ops = { #define SEALS_WANTED (F_SEAL_SHRINK) #define SEALS_DENIED (F_SEAL_WRITE) -static long udmabuf_create(const struct udmabuf_create_list *head, - const struct udmabuf_create_item *list) +static long udmabuf_create(struct miscdevice *device, + struct udmabuf_create_list *head, + struct udmabuf_create_item *list) { DEFINE_DMA_BUF_EXPORT_INFO(exp_info); struct file *memfd = NULL; @@ -200,6 +202,8 @@ static long udmabuf_create(const struct udmabuf_create_list *head, exp_info.flags = O_RDWR; ubuf->flags = head->flags; + ubuf->device = device; + buf = dma_buf_export(&exp_info); if (IS_ERR(buf)) { ret = PTR_ERR(buf); @@ -237,7 +241,7 @@ static long udmabuf_ioctl_create(struct file *filp, unsigned long arg) list.offset = create.offset; list.size = create.size; - return udmabuf_create(&head, &list); + return udmabuf_create(filp->private_data, &head, &list); } static long udmabuf_ioctl_create_list(struct file *filp, unsigned long arg) @@ -256,7 +260,7 @@ static long udmabuf_ioctl_create_list(struct file *filp, unsigned long arg) if (IS_ERR(list)) return PTR_ERR(list); - ret = udmabuf_create(&head, list); + ret = udmabuf_create(filp->private_data, &head, list); kfree(list); return ret; }