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()
471 static void cs_hsi_peek_on_control_complete(struct hsi_msg *msg) in cs_hsi_peek_on_control_complete() argument
473 struct cs_hsi_iface *hi = msg->context; in cs_hsi_peek_on_control_complete()
476 if (msg->status == HSI_STATUS_ERROR) { in cs_hsi_peek_on_control_complete()
478 cs_hsi_control_read_error(hi, msg); in cs_hsi_peek_on_control_complete()
485 msg->sgt.nents = 1; in cs_hsi_peek_on_control_complete()
486 msg->complete = cs_hsi_read_on_control_complete; in cs_hsi_peek_on_control_complete()
487 ret = hsi_async_read(hi->cl, msg); in cs_hsi_peek_on_control_complete()
489 cs_hsi_control_read_error(hi, msg); in cs_hsi_peek_on_control_complete()
494 struct hsi_msg *msg; in cs_hsi_read_on_control() local
512 msg = cs_claim_cmd(hi); in cs_hsi_read_on_control()
515 msg->sgt.nents = 0; in cs_hsi_read_on_control()
516 msg->complete = cs_hsi_peek_on_control_complete; in cs_hsi_read_on_control()
517 ret = hsi_async_read(hi->cl, msg); in cs_hsi_read_on_control()
519 cs_hsi_control_read_error(hi, msg); in cs_hsi_read_on_control()
522 static void cs_hsi_write_on_control_complete(struct hsi_msg *msg) in cs_hsi_write_on_control_complete() argument
524 struct cs_hsi_iface *hi = msg->context; in cs_hsi_write_on_control_complete()
525 if (msg->status == HSI_STATUS_COMPLETED) { in cs_hsi_write_on_control_complete()
528 cs_release_cmd(msg); in cs_hsi_write_on_control_complete()
530 } else if (msg->status == HSI_STATUS_ERROR) { in cs_hsi_write_on_control_complete()
531 cs_hsi_control_write_error(hi, msg); in cs_hsi_write_on_control_complete()
535 msg->status); in cs_hsi_write_on_control_complete()
541 struct hsi_msg *msg; in cs_hsi_write_on_control() local
556 msg = cs_claim_cmd(hi); in cs_hsi_write_on_control()
559 cs_set_cmd(msg, message); in cs_hsi_write_on_control()
560 msg->sgt.nents = 1; in cs_hsi_write_on_control()
561 msg->complete = cs_hsi_write_on_control_complete; in cs_hsi_write_on_control()
564 ret = hsi_async_write(hi->cl, msg); in cs_hsi_write_on_control()
568 cs_hsi_control_write_error(hi, msg); in cs_hsi_write_on_control()
586 static void cs_hsi_read_on_data_complete(struct hsi_msg *msg) in cs_hsi_read_on_data_complete() argument
588 struct cs_hsi_iface *hi = msg->context; in cs_hsi_read_on_data_complete()
591 if (unlikely(msg->status == HSI_STATUS_ERROR)) { in cs_hsi_read_on_data_complete()
592 cs_hsi_data_read_error(hi, msg); in cs_hsi_read_on_data_complete()
613 static void cs_hsi_peek_on_data_complete(struct hsi_msg *msg) in cs_hsi_peek_on_data_complete() argument
615 struct cs_hsi_iface *hi = msg->context; in cs_hsi_peek_on_data_complete()
619 if (unlikely(msg->status == HSI_STATUS_ERROR)) { in cs_hsi_peek_on_data_complete()
620 cs_hsi_data_read_error(hi, msg); in cs_hsi_peek_on_data_complete()
625 cs_hsi_data_read_error(hi, msg); in cs_hsi_peek_on_data_complete()
637 sg_init_one(msg->sgt.sgl, address, hi->buf_size); in cs_hsi_peek_on_data_complete()
638 msg->sgt.nents = 1; in cs_hsi_peek_on_data_complete()
639 msg->complete = cs_hsi_read_on_data_complete; in cs_hsi_peek_on_data_complete()
640 ret = hsi_async_read(hi->cl, msg); in cs_hsi_peek_on_data_complete()
642 cs_hsi_data_read_error(hi, msg); in cs_hsi_peek_on_data_complete()
689 static void cs_hsi_write_on_data_complete(struct hsi_msg *msg) in cs_hsi_write_on_data_complete() argument
691 struct cs_hsi_iface *hi = msg->context; in cs_hsi_write_on_data_complete()
693 if (msg->status == HSI_STATUS_COMPLETED) { in cs_hsi_write_on_data_complete()
700 cs_hsi_data_write_error(hi, msg); in cs_hsi_write_on_data_complete()