Lines Matching refs:supp

22 void optee_supp_init(struct optee_supp *supp)  in optee_supp_init()  argument
24 memset(supp, 0, sizeof(*supp)); in optee_supp_init()
25 mutex_init(&supp->mutex); in optee_supp_init()
26 init_completion(&supp->reqs_c); in optee_supp_init()
27 idr_init(&supp->idr); in optee_supp_init()
28 INIT_LIST_HEAD(&supp->reqs); in optee_supp_init()
29 supp->req_id = -1; in optee_supp_init()
32 void optee_supp_uninit(struct optee_supp *supp) in optee_supp_uninit() argument
34 mutex_destroy(&supp->mutex); in optee_supp_uninit()
35 idr_destroy(&supp->idr); in optee_supp_uninit()
38 void optee_supp_release(struct optee_supp *supp) in optee_supp_release() argument
44 mutex_lock(&supp->mutex); in optee_supp_release()
47 idr_for_each_entry(&supp->idr, req, id) { in optee_supp_release()
48 idr_remove(&supp->idr, id); in optee_supp_release()
54 list_for_each_entry_safe(req, req_tmp, &supp->reqs, link) { in optee_supp_release()
61 supp->ctx = NULL; in optee_supp_release()
62 supp->req_id = -1; in optee_supp_release()
64 mutex_unlock(&supp->mutex); in optee_supp_release()
81 struct optee_supp *supp = &optee->supp; in optee_supp_thrd_req() local
89 if (!supp->ctx && ctx->supp_nowait) in optee_supp_thrd_req()
102 mutex_lock(&supp->mutex); in optee_supp_thrd_req()
103 list_add_tail(&req->link, &supp->reqs); in optee_supp_thrd_req()
105 mutex_unlock(&supp->mutex); in optee_supp_thrd_req()
108 complete(&supp->reqs_c); in optee_supp_thrd_req()
118 mutex_lock(&supp->mutex); in optee_supp_thrd_req()
123 mutex_unlock(&supp->mutex); in optee_supp_thrd_req()
133 static struct optee_supp_req *supp_pop_entry(struct optee_supp *supp, in supp_pop_entry() argument
138 if (supp->req_id != -1) { in supp_pop_entry()
146 if (list_empty(&supp->reqs)) in supp_pop_entry()
149 req = list_first_entry(&supp->reqs, struct optee_supp_req, link); in supp_pop_entry()
156 *id = idr_alloc(&supp->idr, req, 1, 0, GFP_KERNEL); in supp_pop_entry()
215 struct optee_supp *supp = &optee->supp; in optee_supp_recv() local
226 mutex_lock(&supp->mutex); in optee_supp_recv()
227 req = supp_pop_entry(supp, *num_params - num_meta, &id); in optee_supp_recv()
228 mutex_unlock(&supp->mutex); in optee_supp_recv()
244 if (wait_for_completion_interruptible(&supp->reqs_c)) in optee_supp_recv()
259 mutex_lock(&supp->mutex); in optee_supp_recv()
260 supp->req_id = id; in optee_supp_recv()
261 mutex_unlock(&supp->mutex); in optee_supp_recv()
272 static struct optee_supp_req *supp_pop_req(struct optee_supp *supp, in supp_pop_req() argument
286 if (supp->req_id == -1) { in supp_pop_req()
292 id = supp->req_id; in supp_pop_req()
296 req = idr_find(&supp->idr, id); in supp_pop_req()
303 idr_remove(&supp->idr, id); in supp_pop_req()
304 supp->req_id = -1; in supp_pop_req()
324 struct optee_supp *supp = &optee->supp; in optee_supp_send() local
329 mutex_lock(&supp->mutex); in optee_supp_send()
330 req = supp_pop_req(supp, num_params, param, &num_meta); in optee_supp_send()
331 mutex_unlock(&supp->mutex); in optee_supp_send()