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
93 if (!supp->ctx && ctx->supp_nowait) in optee_supp_thrd_req()
106 mutex_lock(&supp->mutex); in optee_supp_thrd_req()
107 list_add_tail(&req->link, &supp->reqs); in optee_supp_thrd_req()
109 mutex_unlock(&supp->mutex); in optee_supp_thrd_req()
112 complete(&supp->reqs_c); in optee_supp_thrd_req()
130 mutex_lock(&supp->mutex); in optee_supp_thrd_req()
150 idr_for_each_entry(&supp->idr, get_req, id) { in optee_supp_thrd_req()
152 idr_remove(&supp->idr, id); in optee_supp_thrd_req()
153 supp->req_id = -1; in optee_supp_thrd_req()
158 mutex_unlock(&supp->mutex); in optee_supp_thrd_req()
172 static struct optee_supp_req *supp_pop_entry(struct optee_supp *supp, in supp_pop_entry() argument
177 if (supp->req_id != -1) { in supp_pop_entry()
185 if (list_empty(&supp->reqs)) in supp_pop_entry()
188 req = list_first_entry(&supp->reqs, struct optee_supp_req, link); in supp_pop_entry()
195 *id = idr_alloc(&supp->idr, req, 1, 0, GFP_KERNEL); in supp_pop_entry()
254 struct optee_supp *supp = &optee->supp; in optee_supp_recv() local
265 mutex_lock(&supp->mutex); in optee_supp_recv()
266 req = supp_pop_entry(supp, *num_params - num_meta, &id); in optee_supp_recv()
267 mutex_unlock(&supp->mutex); in optee_supp_recv()
283 if (wait_for_completion_interruptible(&supp->reqs_c)) in optee_supp_recv()
298 mutex_lock(&supp->mutex); in optee_supp_recv()
299 supp->req_id = id; in optee_supp_recv()
300 mutex_unlock(&supp->mutex); in optee_supp_recv()
311 static struct optee_supp_req *supp_pop_req(struct optee_supp *supp, in supp_pop_req() argument
325 if (supp->req_id == -1) { in supp_pop_req()
331 id = supp->req_id; in supp_pop_req()
335 req = idr_find(&supp->idr, id); in supp_pop_req()
342 idr_remove(&supp->idr, id); in supp_pop_req()
343 supp->req_id = -1; in supp_pop_req()
363 struct optee_supp *supp = &optee->supp; in optee_supp_send() local
368 mutex_lock(&supp->mutex); in optee_supp_send()
369 req = supp_pop_req(supp, num_params, param, &num_meta); in optee_supp_send()
370 mutex_unlock(&supp->mutex); in optee_supp_send()