Commit 044e55b1 authored by Christian König's avatar Christian König

dma-buf: clarify dma_fence_add_callback documentation

That the caller doesn't need to keep a reference is rather
risky and not defensive at all.

Especially dma_buf_poll got that horrible wrong, so better
remove that sentence and also clarify that the callback
might be called in atomic or interrupt context.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210901120240.7339-3-christian.koenig@amd.com
parent b83dcd75
...@@ -616,20 +616,17 @@ EXPORT_SYMBOL(dma_fence_enable_sw_signaling); ...@@ -616,20 +616,17 @@ EXPORT_SYMBOL(dma_fence_enable_sw_signaling);
* @cb: the callback to register * @cb: the callback to register
* @func: the function to call * @func: the function to call
* *
* Add a software callback to the fence. The caller should keep a reference to
* the fence.
*
* @cb will be initialized by dma_fence_add_callback(), no initialization * @cb will be initialized by dma_fence_add_callback(), no initialization
* by the caller is required. Any number of callbacks can be registered * by the caller is required. Any number of callbacks can be registered
* to a fence, but a callback can only be registered to one fence at a time. * to a fence, but a callback can only be registered to one fence at a time.
* *
* Note that the callback can be called from an atomic context. If * If fence is already signaled, this function will return -ENOENT (and
* fence is already signaled, this function will return -ENOENT (and
* *not* call the callback). * *not* call the callback).
* *
* Add a software callback to the fence. Same restrictions apply to * Note that the callback can be called from an atomic context or irq context.
* refcount as it does to dma_fence_wait(), however the caller doesn't need to
* keep a refcount to fence afterward dma_fence_add_callback() has returned:
* when software access is enabled, the creator of the fence is required to keep
* the fence alive until after it signals with dma_fence_signal(). The callback
* itself can be called from irq context.
* *
* Returns 0 in case of success, -ENOENT if the fence is already signaled * Returns 0 in case of success, -ENOENT if the fence is already signaled
* and -EINVAL in case of error. * and -EINVAL in case of error.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment