Lines Matching refs:rpc
881 struct arpc *rpc; in arpc_alloc() local
883 if (size + sizeof(*rpc->req) > ARPC_OUT_SIZE_MAX) in arpc_alloc()
886 rpc = kzalloc(sizeof(*rpc), GFP_KERNEL); in arpc_alloc()
887 if (!rpc) in arpc_alloc()
890 INIT_LIST_HEAD(&rpc->list); in arpc_alloc()
891 rpc->req = kzalloc(sizeof(*rpc->req) + size, GFP_KERNEL); in arpc_alloc()
892 if (!rpc->req) in arpc_alloc()
895 rpc->resp = kzalloc(sizeof(*rpc->resp), GFP_KERNEL); in arpc_alloc()
896 if (!rpc->resp) in arpc_alloc()
899 rpc->req->type = type; in arpc_alloc()
900 rpc->req->size = cpu_to_le16(sizeof(*rpc->req) + size); in arpc_alloc()
901 memcpy(rpc->req->data, payload, size); in arpc_alloc()
903 init_completion(&rpc->response_received); in arpc_alloc()
905 return rpc; in arpc_alloc()
908 kfree(rpc->req); in arpc_alloc()
910 kfree(rpc); in arpc_alloc()
915 static void arpc_free(struct arpc *rpc) in arpc_free() argument
917 kfree(rpc->req); in arpc_free()
918 kfree(rpc->resp); in arpc_free()
919 kfree(rpc); in arpc_free()
924 struct arpc *rpc; in arpc_find() local
926 list_for_each_entry(rpc, &es2->arpcs, list) { in arpc_find()
927 if (rpc->req->id == id) in arpc_find()
928 return rpc; in arpc_find()
934 static void arpc_add(struct es2_ap_dev *es2, struct arpc *rpc) in arpc_add() argument
936 rpc->active = true; in arpc_add()
937 rpc->req->id = cpu_to_le16(es2->arpc_id_cycle++); in arpc_add()
938 list_add_tail(&rpc->list, &es2->arpcs); in arpc_add()
941 static void arpc_del(struct es2_ap_dev *es2, struct arpc *rpc) in arpc_del() argument
943 if (rpc->active) { in arpc_del()
944 rpc->active = false; in arpc_del()
945 list_del(&rpc->list); in arpc_del()
949 static int arpc_send(struct es2_ap_dev *es2, struct arpc *rpc, int timeout) in arpc_send() argument
959 rpc->req, le16_to_cpu(rpc->req->size), in arpc_send()
964 rpc->req->type, retval); in arpc_send()
974 struct arpc *rpc; in arpc_sync() local
981 rpc = arpc_alloc(payload, size, type); in arpc_sync()
982 if (!rpc) in arpc_sync()
986 arpc_add(es2, rpc); in arpc_sync()
989 retval = arpc_send(es2, rpc, timeout); in arpc_sync()
994 &rpc->response_received, in arpc_sync()
1002 if (rpc->resp->result) { in arpc_sync()
1005 *result = rpc->resp->result; in arpc_sync()
1012 arpc_del(es2, rpc); in arpc_sync()
1014 arpc_free(rpc); in arpc_sync()
1029 struct arpc *rpc; in arpc_in_callback() local
1053 rpc = arpc_find(es2, resp->id); in arpc_in_callback()
1054 if (!rpc) { in arpc_in_callback()
1061 arpc_del(es2, rpc); in arpc_in_callback()
1062 memcpy(rpc->resp, resp, sizeof(*resp)); in arpc_in_callback()
1063 complete(&rpc->response_received); in arpc_in_callback()