Scroll to navigation

FENCE_ADD_CALLBACK(9) Device drivers infrastructure FENCE_ADD_CALLBACK(9)


fence_add_callback - add a callback to be called when the fence is signaled


int fence_add_callback(struct fence * fence, struct fence_cb * cb, fence_func_t func);



[in] the fence to wait on


[in] the callback to register


[in] the function to call


cb will be initialized by fence_add_callback, no initialization 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.

Note that the callback can be called from an atomic context. If fence is already signaled, this function will return -ENOENT (and *not* call the callback)

Add a software callback to the fence. Same restrictions apply to refcount as it does to fence_wait, however the caller doesn't need to keep a refcount to fence afterwards: when software access is enabled, the creator of the fence is required to keep the fence alive until after it signals with fence_signal. The callback itself can be called from irq context.


January 2017 Kernel Hackers Manual 4.8.