Lines Matching refs:mtx
43 struct test_mutex *mtx = container_of(work, typeof(*mtx), work); in test_mutex_work() local
45 complete(&mtx->ready); in test_mutex_work()
46 wait_for_completion(&mtx->go); in test_mutex_work()
48 if (mtx->flags & TEST_MTX_TRY) { in test_mutex_work()
49 while (!ww_mutex_trylock(&mtx->mutex, NULL)) in test_mutex_work()
52 ww_mutex_lock(&mtx->mutex, NULL); in test_mutex_work()
54 complete(&mtx->done); in test_mutex_work()
55 ww_mutex_unlock(&mtx->mutex); in test_mutex_work()
61 struct test_mutex mtx; in __test_mutex() local
65 ww_mutex_init(&mtx.mutex, class); in __test_mutex()
69 INIT_WORK_ONSTACK(&mtx.work, test_mutex_work); in __test_mutex()
70 init_completion(&mtx.ready); in __test_mutex()
71 init_completion(&mtx.go); in __test_mutex()
72 init_completion(&mtx.done); in __test_mutex()
73 mtx.flags = flags; in __test_mutex()
75 queue_work(wq, &mtx.work); in __test_mutex()
77 wait_for_completion(&mtx.ready); in __test_mutex()
78 ww_mutex_lock(&mtx.mutex, (flags & TEST_MTX_CTX) ? &ctx : NULL); in __test_mutex()
79 complete(&mtx.go); in __test_mutex()
85 if (completion_done(&mtx.done)) { in __test_mutex()
92 ret = wait_for_completion_timeout(&mtx.done, TIMEOUT); in __test_mutex()
94 ww_mutex_unlock(&mtx.mutex); in __test_mutex()
104 flush_work(&mtx.work); in __test_mutex()
105 destroy_work_on_stack(&mtx.work); in __test_mutex()