Lines Matching +full:loss +full:- +full:of +full:- +full:lock

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
15 * notice, this list of conditions and the following disclaimer in the
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 mtx_init(&c->lock, "gdma_completion", NULL, MTX_DEF); in init_completion()
43 c->done = 0; in init_completion()
49 mtx_destroy(&c->lock); in free_completion()
55 mtx_lock(&c->lock); in complete()
56 c->done++; in complete()
57 mtx_unlock(&c->lock); in complete()
64 mtx_lock(&c->lock); in wait_for_completion()
65 while (c->done == 0) in wait_for_completion()
66 mtx_sleep(c, &c->lock, 0, "gdma_wfc", 0); in wait_for_completion()
67 c->done--; in wait_for_completion()
68 mtx_unlock(&c->lock); in wait_for_completion()
72 * Return: 0 if completed, a non-zero value if timed out.
79 mtx_lock(&c->lock); in wait_for_completion_timeout()
81 if (c->done == 0) in wait_for_completion_timeout()
82 mtx_sleep(c, &c->lock, 0, "gdma_wfc", timeout); in wait_for_completion_timeout()
84 if (c->done > 0) { in wait_for_completion_timeout()
85 c->done--; in wait_for_completion_timeout()
91 mtx_unlock(&c->lock); in wait_for_completion_timeout()