From patchwork Thu Jun 23 15:29:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9195487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2052F6075A for ; Thu, 23 Jun 2016 15:31:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10F5028465 for ; Thu, 23 Jun 2016 15:31:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0604528467; Thu, 23 Jun 2016 15:31:12 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C127A28465 for ; Thu, 23 Jun 2016 15:31:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35A866E97D; Thu, 23 Jun 2016 15:31:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw0-f193.google.com (mail-yw0-f193.google.com [209.85.161.193]) by gabe.freedesktop.org (Postfix) with ESMTPS id C85DE6E978 for ; Thu, 23 Jun 2016 15:30:24 +0000 (UTC) Received: by mail-yw0-f193.google.com with SMTP id f75so11414269ywb.3 for ; Thu, 23 Jun 2016 08:30:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=S7DiXRcpOiWPIvsMa9XiRd5Ef+hsa925PaIKUS+fj+I=; b=bpdFNCUKCvEwbGxE58NkMtRMNeE2krRgdevybAPL1iCN6+Zwer0sHGjY8lSeVLDOWY jTKwF0QcmSiAlQgBfCJOS/5YK1KnoyXwYOSj13PyJJyonMFHOhh1RkHWra7Pj4A12vcG 5o/WLfTVF/zOrYOUnkWsFzPLMRn+SIyDFUrwnVWCyIqJ5jJ+CuQN8lpSc17w5mX2ZKDL JYKpFUhcbqck24/oC6o8vy3i4P4TrFKtSlUdsIbmYuW+ThvJm+N1apKEdPDwt9WPLXNR 5zYK+H9AUsmKFZ4dkh3M+D9Vwd2Cw26jT1R4ypttXeOaz6h5KbiGkgOmlOhXXrqUAgxX aOGQ== X-Gm-Message-State: ALyK8tL6SK7WXubqj4rOQEbAnV0SbiGPc20MLXldAjVPUoQRpqK3ajGrIHXF5S6didC/Fg== X-Received: by 10.37.204.214 with SMTP id l205mr6498308ybf.88.1466695823646; Thu, 23 Jun 2016 08:30:23 -0700 (PDT) Received: from jade.localdomain ([189.61.225.79]) by smtp.gmail.com with ESMTPSA id l81sm346278ywb.34.2016.06.23.08.30.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jun 2016 08:30:23 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [RFC 4/5] dma-buf/fence-array: add fence_array_get_fences() Date: Thu, 23 Jun 2016 12:29:49 -0300 Message-Id: <1466695790-2833-5-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466695790-2833-1-git-send-email-gustavo@padovan.org> References: <1466695790-2833-1-git-send-email-gustavo@padovan.org> Cc: marcheu@google.com, Daniel Stone , seanpaul@google.com, Daniel Vetter , linux-kernel@vger.kernel.org, laurent.pinchart@ideasonboard.com, Gustavo Padovan , John Harrison , m.chehab@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan This function returns a copy of the array of fences. Signed-off-by: Gustavo Padovan --- drivers/dma-buf/fence-array.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/dma-buf/fence-array.c b/drivers/dma-buf/fence-array.c index 601448a..ce98249 100644 --- a/drivers/dma-buf/fence-array.c +++ b/drivers/dma-buf/fence-array.c @@ -33,6 +33,19 @@ static const char *fence_array_get_timeline_name(struct fence *fence) return "unbound"; } +static struct fence **fence_array_get_fences(struct fence *fence) +{ + struct fence_array *array = to_fence_array(fence); + struct fence **fences; + + fences = kmalloc(array->num_fences * sizeof(*fences), GFP_KERNEL); + if (!fences) + return NULL; + + memcpy(fences, array->fences, array->num_fences * sizeof(*fences)); + return fences; +} + static void fence_array_cb_func(struct fence *f, struct fence_cb *cb) { struct fence_array_cb *array_cb = @@ -109,6 +122,7 @@ static void fence_array_release(struct fence *fence) const struct fence_ops fence_array_ops = { .get_driver_name = fence_array_get_driver_name, .get_timeline_name = fence_array_get_timeline_name, + .get_fences = fence_array_get_fences, .enable_signaling = fence_array_enable_signaling, .signaled = fence_array_signaled, .wait = fence_default_wait,