Lines Matching refs:mtx
33 struct test_mutex *mtx = container_of(work, typeof(*mtx), work); in test_mutex_work() local
35 complete(&mtx->ready); in test_mutex_work()
36 wait_for_completion(&mtx->go); in test_mutex_work()
38 if (mtx->flags & TEST_MTX_TRY) { in test_mutex_work()
39 while (!ww_mutex_trylock(&mtx->mutex)) in test_mutex_work()
42 ww_mutex_lock(&mtx->mutex, NULL); in test_mutex_work()
44 complete(&mtx->done); in test_mutex_work()
45 ww_mutex_unlock(&mtx->mutex); in test_mutex_work()
51 struct test_mutex mtx; in __test_mutex() local
55 ww_mutex_init(&mtx.mutex, &ww_class); in __test_mutex()
58 INIT_WORK_ONSTACK(&mtx.work, test_mutex_work); in __test_mutex()
59 init_completion(&mtx.ready); in __test_mutex()
60 init_completion(&mtx.go); in __test_mutex()
61 init_completion(&mtx.done); in __test_mutex()
62 mtx.flags = flags; in __test_mutex()
64 schedule_work(&mtx.work); in __test_mutex()
66 wait_for_completion(&mtx.ready); in __test_mutex()
67 ww_mutex_lock(&mtx.mutex, (flags & TEST_MTX_CTX) ? &ctx : NULL); in __test_mutex()
68 complete(&mtx.go); in __test_mutex()
74 if (completion_done(&mtx.done)) { in __test_mutex()
81 ret = wait_for_completion_timeout(&mtx.done, TIMEOUT); in __test_mutex()
83 ww_mutex_unlock(&mtx.mutex); in __test_mutex()
92 flush_work(&mtx.work); in __test_mutex()
93 destroy_work_on_stack(&mtx.work); in __test_mutex()