From patchwork Thu Aug 1 02:25:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 11070065 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 E994614DB for ; Thu, 1 Aug 2019 02:25:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9CF926E4A for ; Thu, 1 Aug 2019 02:25:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDD8128387; Thu, 1 Aug 2019 02:25:34 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 8B2D528450 for ; Thu, 1 Aug 2019 02:25:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 04EC36E32B; Thu, 1 Aug 2019 02:25:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id C412C6E32B for ; Thu, 1 Aug 2019 02:25:31 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id f5so24336088pgu.5 for ; Wed, 31 Jul 2019 19:25:31 -0700 (PDT) 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=aqzKKaGa1dMKS5TEWbDe5hgoGbuaIfQmr4ypPKza0bE=; b=TJkt5/HpNmJd0mf8iaeVNMsZlS//azY9z+HZigDpYjEsiEWLmT2jrhnnQZvZsb6FoL Am/DqKAFyev1Lk+7Nq2KL9zpEcRu1b9FhoDJtvdi+2cirSD50uThqRjFMEkITHoDbzgS MkOdkEu47dOcFZgr4cMsoBnFJgoujZuWUWujV5/W7zMEq6/A8sjqKfpLmIoOR7X+DbTn +IN6joUR4+KUhCz8uspZMO9y3uldH7FNl4QBCitXnKSRAQZLY87IU9xRoW6aSqU0/jwa vZSQ6l5/2wqeBrAQ5Gwrg7XCvYPpCEC130rzcDtvB1DvkpQCZ/jziLECU+T9+2fYA3JJ z9hQ== X-Gm-Message-State: APjAAAU3Pdc/cjm80VjQF9sPRapNF73kytglbngTarDadaJZlbqH6yg+ vUWG9F2QtISIGECRndPe7585BLhWyuE= X-Google-Smtp-Source: APXvYqykm4/wbMFEnio1+swJf0kTMDYIAJtKEVV29lUNUbgXTTk0Yamvi0pOaMwRDwodJiYIwv7LaQ== X-Received: by 2002:a17:90b:f0f:: with SMTP id br15mr6016904pjb.101.1564626331018; Wed, 31 Jul 2019 19:25:31 -0700 (PDT) Received: from gurchetansingh0.mtv.corp.google.com ([2620:15c:202:201:bc97:5740:52a7:6875]) by smtp.gmail.com with ESMTPSA id v184sm64911342pgd.34.2019.07.31.19.25.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jul 2019 19:25:30 -0700 (PDT) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org Subject: [RFC 4/6] udmabuf: add a pointer to the miscdevice in dma-buf private data Date: Wed, 31 Jul 2019 19:25:15 -0700 Message-Id: <20190801022517.1903-5-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190801022517.1903-1-gurchetansingh@chromium.org> References: <20190801022517.1903-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=aqzKKaGa1dMKS5TEWbDe5hgoGbuaIfQmr4ypPKza0bE=; b=QGzbZnIZlkhzuGiQ7HcGh7FVCpfzJV8UZoZ1QAnRdbzdxhWG1chSVnma22iDqMAmgw N70urbm7YYTVYGb+ACIVrDoTUelX19LFt2UFiegzCO4C3xzmxH5p46llM9jfj0cwW7sq /TkHDFPLvZed9pwsDhwd0NOASpAEJPugha580= 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: kraxel@redhat.com, Gurchetan Singh Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Will be used later. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index 134e53d24c2b..47003abbf4c2 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 *udmabuf_misc; }; static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf) @@ -128,7 +129,8 @@ 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, +static long udmabuf_create(struct miscdevice *udmabuf_misc, + struct udmabuf_create_list *head, const struct udmabuf_create_item *list) { DEFINE_DMA_BUF_EXPORT_INFO(exp_info); @@ -202,6 +204,7 @@ static long udmabuf_create(const struct udmabuf_create_list *head, exp_info.flags = O_WRONLY; ubuf->flags = head->flags; + ubuf->udmabuf_misc = udmabuf_misc; buf = dma_buf_export(&exp_info); if (IS_ERR(buf)) { ret = PTR_ERR(buf); @@ -239,7 +242,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) @@ -258,7 +261,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; }