Lines Matching refs:mtx
42 struct test_mutex *mtx = container_of(work, typeof(*mtx), work); in test_mutex_work() local
44 complete(&mtx->ready); in test_mutex_work()
45 wait_for_completion(&mtx->go); in test_mutex_work()
47 if (mtx->flags & TEST_MTX_TRY) { in test_mutex_work()
48 while (!ww_mutex_trylock(&mtx->mutex, NULL)) in test_mutex_work()
51 ww_mutex_lock(&mtx->mutex, NULL); in test_mutex_work()
53 complete(&mtx->done); in test_mutex_work()
54 ww_mutex_unlock(&mtx->mutex); in test_mutex_work()
60 struct test_mutex mtx; in __test_mutex() local
64 ww_mutex_init(&mtx.mutex, &ww_class); in __test_mutex()
68 INIT_WORK_ONSTACK(&mtx.work, test_mutex_work); in __test_mutex()
69 init_completion(&mtx.ready); in __test_mutex()
70 init_completion(&mtx.go); in __test_mutex()
71 init_completion(&mtx.done); in __test_mutex()
72 mtx.flags = flags; in __test_mutex()
74 schedule_work(&mtx.work); in __test_mutex()
76 wait_for_completion(&mtx.ready); in __test_mutex()
77 ww_mutex_lock(&mtx.mutex, (flags & TEST_MTX_CTX) ? &ctx : NULL); in __test_mutex()
78 complete(&mtx.go); in __test_mutex()
84 if (completion_done(&mtx.done)) { in __test_mutex()
91 ret = wait_for_completion_timeout(&mtx.done, TIMEOUT); in __test_mutex()
93 ww_mutex_unlock(&mtx.mutex); in __test_mutex()
103 flush_work(&mtx.work); in __test_mutex()
104 destroy_work_on_stack(&mtx.work); in __test_mutex()