From patchwork Tue Dec 3 01:36:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 11270137 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 0A32C921 for ; Tue, 3 Dec 2019 01:36:43 +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 E6F88206E1 for ; Tue, 3 Dec 2019 01:36:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E6F88206E1 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 6AD906E12B; Tue, 3 Dec 2019 01:36:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 14D046E12B for ; Tue, 3 Dec 2019 01:36:40 +0000 (UTC) Received: by mail-pf1-x443.google.com with SMTP id h14so878165pfe.10 for ; Mon, 02 Dec 2019 17:36:40 -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=bFT261wHUPXLo9NFa/I8imKlcZ8J4KpDNRcWS6+ZDqI=; b=IRlY3NTWZpCLumFHdn0ND+6cWFK3XxA/qAQFCdLf6d9ZRMQLfA33AFC3+wOanNlTkK lDRoRhVHXqSiJKw5I7VbdvQxgrLyP5yuLBYu33ssjdxowq7BL81RMuVONds6otDR9dRG QMSg14HIY+u4HLBQzYTiX00j4+Qm9DqvAe8Z6osTCDaOKal0vHpoR7ebUnl/LdST8XYi FUrtt6e9OrrxDn+UTfWOftluCR49tdjvi7TI3S/UENCKRgI11fh7E1Kug8LhpbV7C0YF TklBG0w7T/zJ6nh4jFGP5rIi8NmQpyjf7t789dg4j3UxPsL2qKISo3GlJErSfYynu+I1 oWyA== X-Gm-Message-State: APjAAAWIHB/iJZI2TJwaTFXV86Gy6o0wrdNhQMT3YGguR/v5n9wVpCRN 3XkwhJ6ny4zREzjbi2CFAjYtrrfWZ/Y= X-Google-Smtp-Source: APXvYqzSNlfAM3i+NXvH3zKY4If39GEmxvFkh1nOzlPqefoiqkbJId+D0A7Kb0ey3TTnd3KScAX8XQ== X-Received: by 2002:a63:214e:: with SMTP id s14mr2521727pgm.428.1575336999316; Mon, 02 Dec 2019 17:36:39 -0800 (PST) Received: from gurchetansingh0.mtv.corp.google.com ([2620:15c:202:201:bc97:5740:52a7:6875]) by smtp.gmail.com with ESMTPSA id r4sm581916pji.11.2019.12.02.17.36.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Dec 2019 17:36:38 -0800 (PST) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/4] udmabuf: add a pointer to the miscdevice in dma-buf private data Date: Mon, 2 Dec 2019 17:36:25 -0800 Message-Id: <20191203013627.85991-2-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191203013627.85991-1-gurchetansingh@chromium.org> References: <20191203013627.85991-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=bFT261wHUPXLo9NFa/I8imKlcZ8J4KpDNRcWS6+ZDqI=; b=HOXmlk6dQIN7mVVcmk6BZdb883O3coGOpsncWEhYPOzNGdbiD8z3Q5bJzJLadCDKyR J9N6IkSNG9d36Ngz8xAO7SajKXvtPQdiKFJUcMwwS18Sbc4IUf9B3pUjmggA5EecQka2 MAIi9r2iHVTm68WydVGNscs2mpyFgU2X3R/fk= 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 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index be15eb6b0586..f0bf3ba7441e 100644 --- a/drivers/dma-buf/udmabuf.c +++ b/drivers/dma-buf/udmabuf.c @@ -18,6 +18,7 @@ static const size_t size_limit_mb = 64; /* total dmabuf size, in megabytes */ struct udmabuf { pgoff_t pagecount; struct page **pages; + struct miscdevice *device; }; static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf) @@ -104,8 +105,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; @@ -172,6 +174,7 @@ static long udmabuf_create(const struct udmabuf_create_list *head, exp_info.priv = ubuf; exp_info.flags = O_RDWR; + ubuf->device = device; buf = dma_buf_export(&exp_info); if (IS_ERR(buf)) { ret = PTR_ERR(buf); @@ -209,7 +212,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) @@ -228,7 +231,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; }