Lines Matching refs:mtx
46 struct test_mutex *mtx = container_of(work, typeof(*mtx), work); in test_mutex_work() local
48 complete(&mtx->ready); in test_mutex_work()
49 wait_for_completion(&mtx->go); in test_mutex_work()
51 if (mtx->flags & TEST_MTX_TRY) { in test_mutex_work()
52 while (!ww_mutex_trylock(&mtx->mutex)) in test_mutex_work()
55 ww_mutex_lock(&mtx->mutex, NULL); in test_mutex_work()
57 complete(&mtx->done); in test_mutex_work()
58 ww_mutex_unlock(&mtx->mutex); in test_mutex_work()
64 struct test_mutex mtx; in __test_mutex() local
68 ww_mutex_init(&mtx.mutex, &ww_class); in __test_mutex()
71 INIT_WORK_ONSTACK(&mtx.work, test_mutex_work); in __test_mutex()
72 init_completion(&mtx.ready); in __test_mutex()
73 init_completion(&mtx.go); in __test_mutex()
74 init_completion(&mtx.done); in __test_mutex()
75 mtx.flags = flags; in __test_mutex()
77 schedule_work(&mtx.work); in __test_mutex()
79 wait_for_completion(&mtx.ready); in __test_mutex()
80 ww_mutex_lock(&mtx.mutex, (flags & TEST_MTX_CTX) ? &ctx : NULL); in __test_mutex()
81 complete(&mtx.go); in __test_mutex()
87 if (completion_done(&mtx.done)) { in __test_mutex()
94 ret = wait_for_completion_timeout(&mtx.done, TIMEOUT); in __test_mutex()
96 ww_mutex_unlock(&mtx.mutex); in __test_mutex()
105 flush_work(&mtx.work); in __test_mutex()
106 destroy_work_on_stack(&mtx.work); in __test_mutex()