Lines Matching refs:msg
46 u32 msg; member
163 entry->msg = message; in cs_notify()
181 data = entry->msg; in cs_pop_entry()
210 static inline void cs_set_cmd(struct hsi_msg *msg, u32 cmd) in cs_set_cmd() argument
212 u32 *data = sg_virt(msg->sgt.sgl); in cs_set_cmd()
216 static inline u32 cs_get_cmd(struct hsi_msg *msg) in cs_get_cmd() argument
218 u32 *data = sg_virt(msg->sgt.sgl); in cs_get_cmd()
222 static void cs_release_cmd(struct hsi_msg *msg) in cs_release_cmd() argument
224 struct cs_hsi_iface *hi = msg->context; in cs_release_cmd()
226 list_add_tail(&msg->link, &hi->cmdqueue); in cs_release_cmd()
229 static void cs_cmd_destructor(struct hsi_msg *msg) in cs_cmd_destructor() argument
231 struct cs_hsi_iface *hi = msg->context; in cs_cmd_destructor()
240 if (msg->ttype == HSI_MSG_READ) in cs_cmd_destructor()
243 else if (msg->ttype == HSI_MSG_WRITE && in cs_cmd_destructor()
247 cs_release_cmd(msg); in cs_cmd_destructor()
254 struct hsi_msg *msg; in cs_claim_cmd() local
258 msg = list_first_entry(&ssi->cmdqueue, struct hsi_msg, link); in cs_claim_cmd()
259 list_del(&msg->link); in cs_claim_cmd()
260 msg->destructor = cs_cmd_destructor; in cs_claim_cmd()
262 return msg; in cs_claim_cmd()
267 struct hsi_msg *msg, *tmp; in cs_free_cmds() local
269 list_for_each_entry_safe(msg, tmp, &ssi->cmdqueue, link) { in cs_free_cmds()
270 list_del(&msg->link); in cs_free_cmds()
271 msg->destructor = NULL; in cs_free_cmds()
272 kfree(sg_virt(msg->sgt.sgl)); in cs_free_cmds()
273 hsi_free_msg(msg); in cs_free_cmds()
279 struct hsi_msg *msg; in cs_alloc_cmds() local
286 msg = hsi_alloc_msg(1, GFP_KERNEL); in cs_alloc_cmds()
287 if (!msg) in cs_alloc_cmds()
291 hsi_free_msg(msg); in cs_alloc_cmds()
294 sg_init_one(msg->sgt.sgl, buf, sizeof(*buf)); in cs_alloc_cmds()
295 msg->channel = cs_char_data.channel_id_cmd; in cs_alloc_cmds()
296 msg->context = hi; in cs_alloc_cmds()
297 list_add_tail(&msg->link, &hi->cmdqueue); in cs_alloc_cmds()
307 static void cs_hsi_data_destructor(struct hsi_msg *msg) in cs_hsi_data_destructor() argument
309 struct cs_hsi_iface *hi = msg->context; in cs_hsi_data_destructor()
310 const char *dir = (msg->ttype == HSI_MSG_READ) ? "TX" : "RX"; in cs_hsi_data_destructor()
318 if (msg->ttype == HSI_MSG_READ) in cs_hsi_data_destructor()
324 msg->status = HSI_STATUS_COMPLETED; in cs_hsi_data_destructor()
365 static void cs_hsi_free_data_msg(struct hsi_msg *msg) in cs_hsi_free_data_msg() argument
367 WARN_ON(msg->status != HSI_STATUS_COMPLETED && in cs_hsi_free_data_msg()
368 msg->status != HSI_STATUS_ERROR); in cs_hsi_free_data_msg()
369 hsi_free_msg(msg); in cs_hsi_free_data_msg()
379 struct hsi_msg *msg, const char *info, in __cs_hsi_error_pre() argument
384 info, msg->status, *state); in __cs_hsi_error_pre()
405 struct hsi_msg *msg) in cs_hsi_control_read_error() argument
407 __cs_hsi_error_pre(hi, msg, "control read", &hi->control_state); in cs_hsi_control_read_error()
408 cs_release_cmd(msg); in cs_hsi_control_read_error()
414 struct hsi_msg *msg) in cs_hsi_control_write_error() argument
416 __cs_hsi_error_pre(hi, msg, "control write", &hi->control_state); in cs_hsi_control_write_error()
417 cs_release_cmd(msg); in cs_hsi_control_write_error()
423 static void cs_hsi_data_read_error(struct cs_hsi_iface *hi, struct hsi_msg *msg) in cs_hsi_data_read_error() argument
425 __cs_hsi_error_pre(hi, msg, "data read", &hi->data_state); in cs_hsi_data_read_error()
431 struct hsi_msg *msg) in cs_hsi_data_write_error() argument
433 __cs_hsi_error_pre(hi, msg, "data write", &hi->data_state); in cs_hsi_data_write_error()
438 static void cs_hsi_read_on_control_complete(struct hsi_msg *msg) in cs_hsi_read_on_control_complete() argument
440 u32 cmd = cs_get_cmd(msg); in cs_hsi_read_on_control_complete()
441 struct cs_hsi_iface *hi = msg->context; in cs_hsi_read_on_control_complete()
445 if (msg->status == HSI_STATUS_ERROR) { in cs_hsi_read_on_control_complete()
447 cs_hsi_control_read_error(hi, msg); in cs_hsi_read_on_control_complete()
452 cs_release_cmd(msg); in cs_hsi_read_on_control_complete()
466 static void cs_hsi_peek_on_control_complete(struct hsi_msg *msg) in cs_hsi_peek_on_control_complete() argument
468 struct cs_hsi_iface *hi = msg->context; in cs_hsi_peek_on_control_complete()
471 if (msg->status == HSI_STATUS_ERROR) { in cs_hsi_peek_on_control_complete()
473 cs_hsi_control_read_error(hi, msg); in cs_hsi_peek_on_control_complete()
480 msg->sgt.nents = 1; in cs_hsi_peek_on_control_complete()
481 msg->complete = cs_hsi_read_on_control_complete; in cs_hsi_peek_on_control_complete()
482 ret = hsi_async_read(hi->cl, msg); in cs_hsi_peek_on_control_complete()
484 cs_hsi_control_read_error(hi, msg); in cs_hsi_peek_on_control_complete()
489 struct hsi_msg *msg; in cs_hsi_read_on_control() local
507 msg = cs_claim_cmd(hi); in cs_hsi_read_on_control()
510 msg->sgt.nents = 0; in cs_hsi_read_on_control()
511 msg->complete = cs_hsi_peek_on_control_complete; in cs_hsi_read_on_control()
512 ret = hsi_async_read(hi->cl, msg); in cs_hsi_read_on_control()
514 cs_hsi_control_read_error(hi, msg); in cs_hsi_read_on_control()
517 static void cs_hsi_write_on_control_complete(struct hsi_msg *msg) in cs_hsi_write_on_control_complete() argument
519 struct cs_hsi_iface *hi = msg->context; in cs_hsi_write_on_control_complete()
520 if (msg->status == HSI_STATUS_COMPLETED) { in cs_hsi_write_on_control_complete()
523 cs_release_cmd(msg); in cs_hsi_write_on_control_complete()
525 } else if (msg->status == HSI_STATUS_ERROR) { in cs_hsi_write_on_control_complete()
526 cs_hsi_control_write_error(hi, msg); in cs_hsi_write_on_control_complete()
530 msg->status); in cs_hsi_write_on_control_complete()
536 struct hsi_msg *msg; in cs_hsi_write_on_control() local
551 msg = cs_claim_cmd(hi); in cs_hsi_write_on_control()
554 cs_set_cmd(msg, message); in cs_hsi_write_on_control()
555 msg->sgt.nents = 1; in cs_hsi_write_on_control()
556 msg->complete = cs_hsi_write_on_control_complete; in cs_hsi_write_on_control()
559 ret = hsi_async_write(hi->cl, msg); in cs_hsi_write_on_control()
563 cs_hsi_control_write_error(hi, msg); in cs_hsi_write_on_control()
581 static void cs_hsi_read_on_data_complete(struct hsi_msg *msg) in cs_hsi_read_on_data_complete() argument
583 struct cs_hsi_iface *hi = msg->context; in cs_hsi_read_on_data_complete()
586 if (unlikely(msg->status == HSI_STATUS_ERROR)) { in cs_hsi_read_on_data_complete()
587 cs_hsi_data_read_error(hi, msg); in cs_hsi_read_on_data_complete()
608 static void cs_hsi_peek_on_data_complete(struct hsi_msg *msg) in cs_hsi_peek_on_data_complete() argument
610 struct cs_hsi_iface *hi = msg->context; in cs_hsi_peek_on_data_complete()
614 if (unlikely(msg->status == HSI_STATUS_ERROR)) { in cs_hsi_peek_on_data_complete()
615 cs_hsi_data_read_error(hi, msg); in cs_hsi_peek_on_data_complete()
620 cs_hsi_data_read_error(hi, msg); in cs_hsi_peek_on_data_complete()
632 sg_init_one(msg->sgt.sgl, address, hi->buf_size); in cs_hsi_peek_on_data_complete()
633 msg->sgt.nents = 1; in cs_hsi_peek_on_data_complete()
634 msg->complete = cs_hsi_read_on_data_complete; in cs_hsi_peek_on_data_complete()
635 ret = hsi_async_read(hi->cl, msg); in cs_hsi_peek_on_data_complete()
637 cs_hsi_data_read_error(hi, msg); in cs_hsi_peek_on_data_complete()
684 static void cs_hsi_write_on_data_complete(struct hsi_msg *msg) in cs_hsi_write_on_data_complete() argument
686 struct cs_hsi_iface *hi = msg->context; in cs_hsi_write_on_data_complete()
688 if (msg->status == HSI_STATUS_COMPLETED) { in cs_hsi_write_on_data_complete()
695 cs_hsi_data_write_error(hi, msg); in cs_hsi_write_on_data_complete()