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()
67 INIT_WORK_ONSTACK(&mtx.work, test_mutex_work); in __test_mutex()
68 init_completion(&mtx.ready); in __test_mutex()
69 init_completion(&mtx.go); in __test_mutex()
70 init_completion(&mtx.done); in __test_mutex()
71 mtx.flags = flags; in __test_mutex()
73 schedule_work(&mtx.work); in __test_mutex()
75 wait_for_completion(&mtx.ready); in __test_mutex()
76 ww_mutex_lock(&mtx.mutex, (flags & TEST_MTX_CTX) ? &ctx : NULL); in __test_mutex()
77 complete(&mtx.go); in __test_mutex()
83 if (completion_done(&mtx.done)) { in __test_mutex()
90 ret = wait_for_completion_timeout(&mtx.done, TIMEOUT); in __test_mutex()
92 ww_mutex_unlock(&mtx.mutex); in __test_mutex()
101 flush_work(&mtx.work); in __test_mutex()
102 destroy_work_on_stack(&mtx.work); in __test_mutex()