Lines Matching refs:rpc

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