Lines Matching refs:msg

33 	u32			msg;  member
150 entry->msg = message; in cs_notify()
168 data = entry->msg; in cs_pop_entry()
197 static inline void cs_set_cmd(struct hsi_msg *msg, u32 cmd) in cs_set_cmd() argument
199 u32 *data = sg_virt(msg->sgt.sgl); in cs_set_cmd()
203 static inline u32 cs_get_cmd(struct hsi_msg *msg) in cs_get_cmd() argument
205 u32 *data = sg_virt(msg->sgt.sgl); in cs_get_cmd()
209 static void cs_release_cmd(struct hsi_msg *msg) in cs_release_cmd() argument
211 struct cs_hsi_iface *hi = msg->context; in cs_release_cmd()
213 list_add_tail(&msg->link, &hi->cmdqueue); in cs_release_cmd()
216 static void cs_cmd_destructor(struct hsi_msg *msg) in cs_cmd_destructor() argument
218 struct cs_hsi_iface *hi = msg->context; in cs_cmd_destructor()
227 if (msg->ttype == HSI_MSG_READ) in cs_cmd_destructor()
230 else if (msg->ttype == HSI_MSG_WRITE && in cs_cmd_destructor()
234 cs_release_cmd(msg); in cs_cmd_destructor()
241 struct hsi_msg *msg; in cs_claim_cmd() local
245 msg = list_first_entry(&ssi->cmdqueue, struct hsi_msg, link); in cs_claim_cmd()
246 list_del(&msg->link); in cs_claim_cmd()
247 msg->destructor = cs_cmd_destructor; in cs_claim_cmd()
249 return msg; in cs_claim_cmd()
254 struct hsi_msg *msg, *tmp; in cs_free_cmds() local
256 list_for_each_entry_safe(msg, tmp, &ssi->cmdqueue, link) { in cs_free_cmds()
257 list_del(&msg->link); in cs_free_cmds()
258 msg->destructor = NULL; in cs_free_cmds()
259 kfree(sg_virt(msg->sgt.sgl)); in cs_free_cmds()
260 hsi_free_msg(msg); in cs_free_cmds()
266 struct hsi_msg *msg; in cs_alloc_cmds() local
273 msg = hsi_alloc_msg(1, GFP_KERNEL); in cs_alloc_cmds()
274 if (!msg) in cs_alloc_cmds()
278 hsi_free_msg(msg); in cs_alloc_cmds()
281 sg_init_one(msg->sgt.sgl, buf, sizeof(*buf)); in cs_alloc_cmds()
282 msg->channel = cs_char_data.channel_id_cmd; in cs_alloc_cmds()
283 msg->context = hi; in cs_alloc_cmds()
284 list_add_tail(&msg->link, &hi->cmdqueue); in cs_alloc_cmds()
294 static void cs_hsi_data_destructor(struct hsi_msg *msg) in cs_hsi_data_destructor() argument
296 struct cs_hsi_iface *hi = msg->context; in cs_hsi_data_destructor()
297 const char *dir = (msg->ttype == HSI_MSG_READ) ? "TX" : "RX"; in cs_hsi_data_destructor()
305 if (msg->ttype == HSI_MSG_READ) in cs_hsi_data_destructor()
311 msg->status = HSI_STATUS_COMPLETED; in cs_hsi_data_destructor()
352 static void cs_hsi_free_data_msg(struct hsi_msg *msg) in cs_hsi_free_data_msg() argument
354 WARN_ON(msg->status != HSI_STATUS_COMPLETED && in cs_hsi_free_data_msg()
355 msg->status != HSI_STATUS_ERROR); in cs_hsi_free_data_msg()
356 hsi_free_msg(msg); in cs_hsi_free_data_msg()
366 struct hsi_msg *msg, const char *info, in __cs_hsi_error_pre() argument
371 info, msg->status, *state); in __cs_hsi_error_pre()
392 struct hsi_msg *msg) in cs_hsi_control_read_error() argument
394 __cs_hsi_error_pre(hi, msg, "control read", &hi->control_state); in cs_hsi_control_read_error()
395 cs_release_cmd(msg); in cs_hsi_control_read_error()
401 struct hsi_msg *msg) in cs_hsi_control_write_error() argument
403 __cs_hsi_error_pre(hi, msg, "control write", &hi->control_state); in cs_hsi_control_write_error()
404 cs_release_cmd(msg); in cs_hsi_control_write_error()
410 static void cs_hsi_data_read_error(struct cs_hsi_iface *hi, struct hsi_msg *msg) in cs_hsi_data_read_error() argument
412 __cs_hsi_error_pre(hi, msg, "data read", &hi->data_state); in cs_hsi_data_read_error()
418 struct hsi_msg *msg) in cs_hsi_data_write_error() argument
420 __cs_hsi_error_pre(hi, msg, "data write", &hi->data_state); in cs_hsi_data_write_error()
425 static void cs_hsi_read_on_control_complete(struct hsi_msg *msg) in cs_hsi_read_on_control_complete() argument
427 u32 cmd = cs_get_cmd(msg); in cs_hsi_read_on_control_complete()
428 struct cs_hsi_iface *hi = msg->context; in cs_hsi_read_on_control_complete()
432 if (msg->status == HSI_STATUS_ERROR) { in cs_hsi_read_on_control_complete()
435 cs_hsi_control_read_error(hi, msg); in cs_hsi_read_on_control_complete()
439 cs_release_cmd(msg); in cs_hsi_read_on_control_complete()
458 static void cs_hsi_peek_on_control_complete(struct hsi_msg *msg) in cs_hsi_peek_on_control_complete() argument
460 struct cs_hsi_iface *hi = msg->context; in cs_hsi_peek_on_control_complete()
463 if (msg->status == HSI_STATUS_ERROR) { in cs_hsi_peek_on_control_complete()
465 cs_hsi_control_read_error(hi, msg); in cs_hsi_peek_on_control_complete()
472 msg->sgt.nents = 1; in cs_hsi_peek_on_control_complete()
473 msg->complete = cs_hsi_read_on_control_complete; in cs_hsi_peek_on_control_complete()
474 ret = hsi_async_read(hi->cl, msg); in cs_hsi_peek_on_control_complete()
476 cs_hsi_control_read_error(hi, msg); in cs_hsi_peek_on_control_complete()
481 struct hsi_msg *msg; in cs_hsi_read_on_control() local
499 msg = cs_claim_cmd(hi); in cs_hsi_read_on_control()
502 msg->sgt.nents = 0; in cs_hsi_read_on_control()
503 msg->complete = cs_hsi_peek_on_control_complete; in cs_hsi_read_on_control()
504 ret = hsi_async_read(hi->cl, msg); in cs_hsi_read_on_control()
506 cs_hsi_control_read_error(hi, msg); in cs_hsi_read_on_control()
509 static void cs_hsi_write_on_control_complete(struct hsi_msg *msg) in cs_hsi_write_on_control_complete() argument
511 struct cs_hsi_iface *hi = msg->context; in cs_hsi_write_on_control_complete()
512 if (msg->status == HSI_STATUS_COMPLETED) { in cs_hsi_write_on_control_complete()
515 cs_release_cmd(msg); in cs_hsi_write_on_control_complete()
517 } else if (msg->status == HSI_STATUS_ERROR) { in cs_hsi_write_on_control_complete()
518 cs_hsi_control_write_error(hi, msg); in cs_hsi_write_on_control_complete()
522 msg->status); in cs_hsi_write_on_control_complete()
528 struct hsi_msg *msg; in cs_hsi_write_on_control() local
543 msg = cs_claim_cmd(hi); in cs_hsi_write_on_control()
546 cs_set_cmd(msg, message); in cs_hsi_write_on_control()
547 msg->sgt.nents = 1; in cs_hsi_write_on_control()
548 msg->complete = cs_hsi_write_on_control_complete; in cs_hsi_write_on_control()
551 ret = hsi_async_write(hi->cl, msg); in cs_hsi_write_on_control()
555 cs_hsi_control_write_error(hi, msg); in cs_hsi_write_on_control()
573 static void cs_hsi_read_on_data_complete(struct hsi_msg *msg) in cs_hsi_read_on_data_complete() argument
575 struct cs_hsi_iface *hi = msg->context; in cs_hsi_read_on_data_complete()
578 if (unlikely(msg->status == HSI_STATUS_ERROR)) { in cs_hsi_read_on_data_complete()
579 cs_hsi_data_read_error(hi, msg); in cs_hsi_read_on_data_complete()
600 static void cs_hsi_peek_on_data_complete(struct hsi_msg *msg) in cs_hsi_peek_on_data_complete() argument
602 struct cs_hsi_iface *hi = msg->context; in cs_hsi_peek_on_data_complete()
606 if (unlikely(msg->status == HSI_STATUS_ERROR)) { in cs_hsi_peek_on_data_complete()
607 cs_hsi_data_read_error(hi, msg); in cs_hsi_peek_on_data_complete()
612 cs_hsi_data_read_error(hi, msg); in cs_hsi_peek_on_data_complete()
624 sg_init_one(msg->sgt.sgl, address, hi->buf_size); in cs_hsi_peek_on_data_complete()
625 msg->sgt.nents = 1; in cs_hsi_peek_on_data_complete()
626 msg->complete = cs_hsi_read_on_data_complete; in cs_hsi_peek_on_data_complete()
627 ret = hsi_async_read(hi->cl, msg); in cs_hsi_peek_on_data_complete()
629 cs_hsi_data_read_error(hi, msg); in cs_hsi_peek_on_data_complete()
676 static void cs_hsi_write_on_data_complete(struct hsi_msg *msg) in cs_hsi_write_on_data_complete() argument
678 struct cs_hsi_iface *hi = msg->context; in cs_hsi_write_on_data_complete()
680 if (msg->status == HSI_STATUS_COMPLETED) { in cs_hsi_write_on_data_complete()
687 cs_hsi_data_write_error(hi, msg); in cs_hsi_write_on_data_complete()