From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751317AbcFWUgO (ORCPT ); Thu, 23 Jun 2016 16:36:14 -0400 Received: from mail.fireflyinternet.com ([87.106.93.118]:57432 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750874AbcFWUgN (ORCPT ); Thu, 23 Jun 2016 16:36:13 -0400 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Date: Thu, 23 Jun 2016 21:35:56 +0100 From: Chris Wilson To: Gustavo Padovan Cc: dri-devel@lists.freedesktop.org, 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 Subject: Re: [RFC 4/5] dma-buf/fence-array: add fence_array_get_fences() Message-ID: <20160623203556.GA1086@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Gustavo Padovan , dri-devel@lists.freedesktop.org, 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 References: <1466695790-2833-1-git-send-email-gustavo@padovan.org> <1466695790-2833-5-git-send-email-gustavo@padovan.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1466695790-2833-5-git-send-email-gustavo@padovan.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 23, 2016 at 12:29:49PM -0300, Gustavo Padovan wrote: > 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; return kmemdup(array->fences, array->num_fences * sizeof(*array->fences), GFP_KERNEL); -- Chris Wilson, Intel Open Source Technology Centre