1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>fence_add_callback</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="ch02s03.html" title="Device Drivers DMA Management"><link rel="prev" href="API-fence-enable-sw-signaling.html" title="fence_enable_sw_signaling"><link rel="next" href="API-fence-remove-callback.html" title="fence_remove_callback"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">fence_add_callback</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-fence-enable-sw-signaling.html">Prev</a>&#160;</td><th width="60%" align="center">Device Drivers DMA Management</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-fence-remove-callback.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-fence-add-callback"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>fence_add_callback &#8212; 
2     add a callback to be called when the fence is signaled
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">fence_add_callback </b>(</code></td><td>struct fence * <var class="pdparam">fence</var>, </td></tr><tr><td>&#160;</td><td>struct fence_cb * <var class="pdparam">cb</var>, </td></tr><tr><td>&#160;</td><td>fence_func_t <var class="pdparam">func</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1110338148"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>fence</code></em></span></dt><dd><p>
4     [in]	the fence to wait on
5    </p></dd><dt><span class="term"><em class="parameter"><code>cb</code></em></span></dt><dd><p>
6     [in]	the callback to register
7    </p></dd><dt><span class="term"><em class="parameter"><code>func</code></em></span></dt><dd><p>
8     [in]	the function to call
9    </p></dd></dl></div></div><div class="refsect1"><a name="idp1110341820"></a><h2>Description</h2><p>
10   cb will be initialized by fence_add_callback, no initialization
11   by the caller is required. Any number of callbacks can be registered
12   to a fence, but a callback can only be registered to one fence at a time.
13   </p><p>
14
15   Note that the callback can be called from an atomic context.  If
16   fence is already signaled, this function will return -ENOENT (and
17   *not* call the callback)
18   </p><p>
19
20   Add a software callback to the fence. Same restrictions apply to
21   refcount as it does to fence_wait, however the caller doesn't need to
22</p></div><div class="refsect1"><a name="idp1110343228"></a><h2>keep a refcount to fence afterwards</h2><p>
23   when software access is enabled,
24   the creator of the fence is required to keep the fence alive until
25   after it signals with fence_signal. The callback itself can be called
26   from irq context.
27</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-fence-enable-sw-signaling.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch02s03.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-fence-remove-callback.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">fence_enable_sw_signaling</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">fence_remove_callback</span></td></tr></table></div></body></html>
28