Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging/android/sync: add sync_fence_create_dma

This allows users of dma fences to create a android fence.

v2: Added kerneldoc. (Tvrtko Ursulin).

v4: Updated comments from review feedback my Maarten.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: devel@driverdev.osuosl.org
Cc: Riley Andrews <riandrews@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Maarten Lankhorst and committed by
Greg Kroah-Hartman
0f477c6d 73465f1c

+19 -4
+9 -4
drivers/staging/android/sync.c
··· 188 188 } 189 189 190 190 /* TODO: implement a create which takes more that one sync_pt */ 191 - struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) 191 + struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt) 192 192 { 193 193 struct sync_fence *fence; 194 194 ··· 199 199 fence->num_fences = 1; 200 200 atomic_set(&fence->status, 1); 201 201 202 - fence->cbs[0].sync_pt = &pt->base; 202 + fence->cbs[0].sync_pt = pt; 203 203 fence->cbs[0].fence = fence; 204 - if (fence_add_callback(&pt->base, &fence->cbs[0].cb, 205 - fence_check_cb_func)) 204 + if (fence_add_callback(pt, &fence->cbs[0].cb, fence_check_cb_func)) 206 205 atomic_dec(&fence->status); 207 206 208 207 sync_fence_debug_add(fence); 209 208 210 209 return fence; 210 + } 211 + EXPORT_SYMBOL(sync_fence_create_dma); 212 + 213 + struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) 214 + { 215 + return sync_fence_create_dma(name, &pt->base); 211 216 } 212 217 EXPORT_SYMBOL(sync_fence_create); 213 218
+10
drivers/staging/android/sync.h
··· 254 254 */ 255 255 struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt); 256 256 257 + /** 258 + * sync_fence_create_dma() - creates a sync fence from dma-fence 259 + * @name: name of fence to create 260 + * @pt: dma-fence to add to the fence 261 + * 262 + * Creates a fence containg @pt. Once this is called, the fence takes 263 + * ownership of @pt. 264 + */ 265 + struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt); 266 + 257 267 /* 258 268 * API for sync_fence consumers 259 269 */