Skip to content

Commit

Permalink
dma-buf/sw-sync: sync_pt is private and of fixed size
Browse files Browse the repository at this point in the history
Since sync_pt is only allocated from a single location and is no longer
the base class for fences (that is struct dma_fence) it no longer needs
a generic unsized allocator.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Gustavo Padovan <gustavo@padovan.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170629125930.821-5-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson authored and Gustavo Padovan committed Jun 29, 2017
1 parent a6aa8fc commit 3b52ce4
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/dma-buf/sw_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,23 +155,19 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
/**
* sync_pt_create() - creates a sync pt
* @parent: fence's parent sync_timeline
* @size: size to allocate for this pt
* @inc: value of the fence
*
* Creates a new sync_pt as a child of @parent. @size bytes will be
* allocated allowing for implementation specific data to be kept after
* the generic sync_timeline struct. Returns the sync_pt object or
* NULL in case of error.
*/
static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
unsigned int value)
static struct sync_pt *sync_pt_create(struct sync_timeline *obj,
unsigned int value)
{
struct sync_pt *pt;

if (size < sizeof(*pt))
return NULL;

pt = kzalloc(size, GFP_KERNEL);
pt = kzalloc(sizeof(*pt), GFP_KERNEL);
if (!pt)
return NULL;

Expand Down Expand Up @@ -312,7 +308,7 @@ static long sw_sync_ioctl_create_fence(struct sync_timeline *obj,
goto err;
}

pt = sync_pt_create(obj, sizeof(*pt), data.value);
pt = sync_pt_create(obj, data.value);
if (!pt) {
err = -ENOMEM;
goto err;
Expand Down

0 comments on commit 3b52ce4

Please sign in to comment.