Lines Matching refs:supp

31 void optee_supp_init(struct optee_supp *supp)  in optee_supp_init()  argument
33 memset(supp, 0, sizeof(*supp)); in optee_supp_init()
34 mutex_init(&supp->mutex); in optee_supp_init()
35 init_completion(&supp->reqs_c); in optee_supp_init()
36 idr_init(&supp->idr); in optee_supp_init()
37 INIT_LIST_HEAD(&supp->reqs); in optee_supp_init()
38 supp->req_id = -1; in optee_supp_init()
41 void optee_supp_uninit(struct optee_supp *supp) in optee_supp_uninit() argument
43 mutex_destroy(&supp->mutex); in optee_supp_uninit()
44 idr_destroy(&supp->idr); in optee_supp_uninit()
47 void optee_supp_release(struct optee_supp *supp) in optee_supp_release() argument
53 mutex_lock(&supp->mutex); in optee_supp_release()
56 idr_for_each_entry(&supp->idr, req, id) { in optee_supp_release()
58 idr_remove(&supp->idr, id); in optee_supp_release()
64 list_for_each_entry_safe(req, req_tmp, &supp->reqs, link) { in optee_supp_release()
70 supp->ctx = NULL; in optee_supp_release()
71 supp->req_id = -1; in optee_supp_release()
73 mutex_unlock(&supp->mutex); in optee_supp_release()
90 struct optee_supp *supp = &optee->supp; in optee_supp_thrd_req() local
104 mutex_lock(&supp->mutex); in optee_supp_thrd_req()
105 list_add_tail(&req->link, &supp->reqs); in optee_supp_thrd_req()
106 mutex_unlock(&supp->mutex); in optee_supp_thrd_req()
109 complete(&supp->reqs_c); in optee_supp_thrd_req()
117 mutex_lock(&supp->mutex); in optee_supp_thrd_req()
118 interruptable = !supp->ctx; in optee_supp_thrd_req()
137 mutex_unlock(&supp->mutex); in optee_supp_thrd_req()
151 static struct optee_supp_req *supp_pop_entry(struct optee_supp *supp, in supp_pop_entry() argument
156 if (supp->req_id != -1) { in supp_pop_entry()
164 if (list_empty(&supp->reqs)) in supp_pop_entry()
167 req = list_first_entry(&supp->reqs, struct optee_supp_req, link); in supp_pop_entry()
174 *id = idr_alloc(&supp->idr, req, 1, 0, GFP_KERNEL); in supp_pop_entry()
233 struct optee_supp *supp = &optee->supp; in optee_supp_recv() local
244 mutex_lock(&supp->mutex); in optee_supp_recv()
245 req = supp_pop_entry(supp, *num_params - num_meta, &id); in optee_supp_recv()
246 mutex_unlock(&supp->mutex); in optee_supp_recv()
262 if (wait_for_completion_interruptible(&supp->reqs_c)) in optee_supp_recv()
277 mutex_lock(&supp->mutex); in optee_supp_recv()
278 supp->req_id = id; in optee_supp_recv()
279 mutex_unlock(&supp->mutex); in optee_supp_recv()
290 static struct optee_supp_req *supp_pop_req(struct optee_supp *supp, in supp_pop_req() argument
304 if (supp->req_id == -1) { in supp_pop_req()
310 id = supp->req_id; in supp_pop_req()
314 req = idr_find(&supp->idr, id); in supp_pop_req()
322 idr_remove(&supp->idr, id); in supp_pop_req()
323 supp->req_id = -1; in supp_pop_req()
343 struct optee_supp *supp = &optee->supp; in optee_supp_send() local
348 mutex_lock(&supp->mutex); in optee_supp_send()
349 req = supp_pop_req(supp, num_params, param, &num_meta); in optee_supp_send()
350 mutex_unlock(&supp->mutex); in optee_supp_send()