Lines Matching refs:msg
34 struct ipc_message *msg = NULL; in msg_get_empty() local
37 msg = list_first_entry(&ipc->empty_list, struct ipc_message, in msg_get_empty()
39 list_del(&msg->list); in msg_get_empty()
42 return msg; in msg_get_empty()
46 struct ipc_message *msg, struct sst_ipc_message *reply) in tx_wait_done() argument
52 ret = wait_event_timeout(msg->waitq, msg->complete, in tx_wait_done()
60 list_del(&msg->list); in tx_wait_done()
66 reply->header = msg->rx.header; in tx_wait_done()
68 memcpy(reply->data, msg->rx.data, msg->rx.size); in tx_wait_done()
70 ret = msg->errno; in tx_wait_done()
73 list_add_tail(&msg->list, &ipc->empty_list); in tx_wait_done()
82 struct ipc_message *msg; in ipc_tx_message() local
87 msg = msg_get_empty(ipc); in ipc_tx_message()
88 if (msg == NULL) { in ipc_tx_message()
93 msg->tx.header = request.header; in ipc_tx_message()
94 msg->tx.size = request.size; in ipc_tx_message()
95 msg->rx.header = 0; in ipc_tx_message()
96 msg->rx.size = reply ? reply->size : 0; in ipc_tx_message()
97 msg->wait = wait; in ipc_tx_message()
98 msg->errno = 0; in ipc_tx_message()
99 msg->pending = false; in ipc_tx_message()
100 msg->complete = false; in ipc_tx_message()
103 ipc->ops.tx_data_copy(msg, request.data, request.size); in ipc_tx_message()
105 list_add_tail(&msg->list, &ipc->tx_list); in ipc_tx_message()
110 return tx_wait_done(ipc, msg, reply); in ipc_tx_message()
119 ipc->msg = kcalloc(IPC_EMPTY_LIST_SIZE, sizeof(struct ipc_message), in msg_empty_list_init()
121 if (ipc->msg == NULL) in msg_empty_list_init()
125 ipc->msg[i].tx.data = kzalloc(ipc->tx_data_max_size, GFP_KERNEL); in msg_empty_list_init()
126 if (ipc->msg[i].tx.data == NULL) in msg_empty_list_init()
129 ipc->msg[i].rx.data = kzalloc(ipc->rx_data_max_size, GFP_KERNEL); in msg_empty_list_init()
130 if (ipc->msg[i].rx.data == NULL) { in msg_empty_list_init()
131 kfree(ipc->msg[i].tx.data); in msg_empty_list_init()
135 init_waitqueue_head(&ipc->msg[i].waitq); in msg_empty_list_init()
136 list_add(&ipc->msg[i].list, &ipc->empty_list); in msg_empty_list_init()
143 kfree(ipc->msg[i-1].tx.data); in msg_empty_list_init()
144 kfree(ipc->msg[i-1].rx.data); in msg_empty_list_init()
147 kfree(ipc->msg); in msg_empty_list_init()
156 struct ipc_message *msg; in ipc_tx_msgs() local
170 msg = list_first_entry(&ipc->tx_list, struct ipc_message, list); in ipc_tx_msgs()
171 list_move(&msg->list, &ipc->rx_list); in ipc_tx_msgs()
174 ipc->ops.tx_msg(ipc, msg); in ipc_tx_msgs()
221 struct ipc_message *msg; in sst_ipc_reply_find_msg() local
235 list_for_each_entry(msg, &ipc->rx_list, list) { in sst_ipc_reply_find_msg()
236 if ((msg->tx.header & mask) == header) in sst_ipc_reply_find_msg()
237 return msg; in sst_ipc_reply_find_msg()
246 struct ipc_message *msg) in sst_ipc_tx_msg_reply_complete() argument
248 msg->complete = true; in sst_ipc_tx_msg_reply_complete()
250 if (!msg->wait) in sst_ipc_tx_msg_reply_complete()
251 list_add_tail(&msg->list, &ipc->empty_list); in sst_ipc_tx_msg_reply_complete()
253 wake_up(&msg->waitq); in sst_ipc_tx_msg_reply_complete()
281 if (ipc->msg) { in sst_ipc_fini()
283 kfree(ipc->msg[i].tx.data); in sst_ipc_fini()
284 kfree(ipc->msg[i].rx.data); in sst_ipc_fini()
286 kfree(ipc->msg); in sst_ipc_fini()