Lines Matching refs:cb

342 void mei_io_cb_free(struct mei_cl_cb *cb)  in mei_io_cb_free()  argument
344 if (cb == NULL) in mei_io_cb_free()
347 list_del(&cb->list); in mei_io_cb_free()
348 kfree(cb->buf.data); in mei_io_cb_free()
349 kfree(cb); in mei_io_cb_free()
360 static inline void mei_tx_cb_enqueue(struct mei_cl_cb *cb, in mei_tx_cb_enqueue() argument
363 list_add_tail(&cb->list, head); in mei_tx_cb_enqueue()
364 cb->cl->tx_cb_queued++; in mei_tx_cb_enqueue()
374 static inline void mei_tx_cb_dequeue(struct mei_cl_cb *cb) in mei_tx_cb_dequeue() argument
376 if (!WARN_ON(cb->cl->tx_cb_queued == 0)) in mei_tx_cb_dequeue()
377 cb->cl->tx_cb_queued--; in mei_tx_cb_dequeue()
379 mei_io_cb_free(cb); in mei_tx_cb_dequeue()
395 struct mei_cl_cb *cb; in mei_io_cb_init() local
397 cb = kzalloc(sizeof(struct mei_cl_cb), GFP_KERNEL); in mei_io_cb_init()
398 if (!cb) in mei_io_cb_init()
401 INIT_LIST_HEAD(&cb->list); in mei_io_cb_init()
402 cb->fp = fp; in mei_io_cb_init()
403 cb->cl = cl; in mei_io_cb_init()
404 cb->buf_idx = 0; in mei_io_cb_init()
405 cb->fop_type = type; in mei_io_cb_init()
406 return cb; in mei_io_cb_init()
418 struct mei_cl_cb *cb, *next; in mei_io_list_flush_cl() local
420 list_for_each_entry_safe(cb, next, head, list) { in mei_io_list_flush_cl()
421 if (mei_cl_cmp_id(cl, cb->cl)) in mei_io_list_flush_cl()
422 list_del_init(&cb->list); in mei_io_list_flush_cl()
435 struct mei_cl_cb *cb, *next; in mei_io_tx_list_free_cl() local
437 list_for_each_entry_safe(cb, next, head, list) { in mei_io_tx_list_free_cl()
438 if (mei_cl_cmp_id(cl, cb->cl)) in mei_io_tx_list_free_cl()
439 mei_tx_cb_dequeue(cb); in mei_io_tx_list_free_cl()
451 struct mei_cl_cb *cb, *next; in mei_io_list_free_fp() local
453 list_for_each_entry_safe(cb, next, head, list) in mei_io_list_free_fp()
454 if (!fp || fp == cb->fp) in mei_io_list_free_fp()
455 mei_io_cb_free(cb); in mei_io_list_free_fp()
472 struct mei_cl_cb *cb; in mei_cl_alloc_cb() local
474 cb = mei_io_cb_init(cl, fop_type, fp); in mei_cl_alloc_cb()
475 if (!cb) in mei_cl_alloc_cb()
479 return cb; in mei_cl_alloc_cb()
481 cb->buf.data = kmalloc(length, GFP_KERNEL); in mei_cl_alloc_cb()
482 if (!cb->buf.data) { in mei_cl_alloc_cb()
483 mei_io_cb_free(cb); in mei_cl_alloc_cb()
486 cb->buf.size = length; in mei_cl_alloc_cb()
488 return cb; in mei_cl_alloc_cb()
507 struct mei_cl_cb *cb; in mei_cl_enqueue_ctrl_wr_cb() local
513 cb = mei_cl_alloc_cb(cl, length, fop_type, fp); in mei_cl_enqueue_ctrl_wr_cb()
514 if (!cb) in mei_cl_enqueue_ctrl_wr_cb()
517 list_add_tail(&cb->list, &cl->dev->ctrl_wr_list); in mei_cl_enqueue_ctrl_wr_cb()
518 return cb; in mei_cl_enqueue_ctrl_wr_cb()
532 struct mei_cl_cb *cb; in mei_cl_read_cb() local
534 list_for_each_entry(cb, &cl->rd_completed, list) in mei_cl_read_cb()
535 if (!fp || fp == cb->fp) in mei_cl_read_cb()
536 return cb; in mei_cl_read_cb()
827 static int mei_cl_send_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb) in mei_cl_send_disconnect() argument
841 list_move_tail(&cb->list, &dev->ctrl_rd_list); in mei_cl_send_disconnect()
858 int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb, in mei_cl_irq_disconnect() argument
874 ret = mei_cl_send_disconnect(cl, cb); in mei_cl_irq_disconnect()
876 list_move_tail(&cb->list, cmpl_list); in mei_cl_irq_disconnect()
892 struct mei_cl_cb *cb; in __mei_cl_disconnect() local
899 cb = mei_cl_enqueue_ctrl_wr_cb(cl, 0, MEI_FOP_DISCONNECT, NULL); in __mei_cl_disconnect()
900 if (!cb) { in __mei_cl_disconnect()
906 rets = mei_cl_send_disconnect(cl, cb); in __mei_cl_disconnect()
933 mei_io_cb_free(cb); in __mei_cl_disconnect()
1000 struct mei_cl_cb *cb; in mei_cl_is_other_connecting() local
1004 list_for_each_entry(cb, &dev->ctrl_rd_list, list) { in mei_cl_is_other_connecting()
1005 if (cb->fop_type == MEI_FOP_CONNECT && in mei_cl_is_other_connecting()
1006 mei_cl_me_id(cl) == mei_cl_me_id(cb->cl)) in mei_cl_is_other_connecting()
1021 static int mei_cl_send_connect(struct mei_cl *cl, struct mei_cl_cb *cb) in mei_cl_send_connect() argument
1035 list_move_tail(&cb->list, &dev->ctrl_rd_list); in mei_cl_send_connect()
1050 int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb, in mei_cl_irq_connect() argument
1069 rets = mei_cl_send_connect(cl, cb); in mei_cl_irq_connect()
1071 list_move_tail(&cb->list, cmpl_list); in mei_cl_irq_connect()
1091 struct mei_cl_cb *cb; in mei_cl_connect() local
1116 cb = mei_cl_enqueue_ctrl_wr_cb(cl, 0, MEI_FOP_CONNECT, fp); in mei_cl_connect()
1117 if (!cb) { in mei_cl_connect()
1124 rets = mei_cl_send_connect(cl, cb); in mei_cl_connect()
1161 mei_io_cb_free(cb); in mei_cl_connect()
1292 int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb, in mei_cl_irq_notify() argument
1309 request = mei_cl_notify_fop2req(cb->fop_type); in mei_cl_irq_notify()
1313 list_move_tail(&cb->list, cmpl_list); in mei_cl_irq_notify()
1317 list_move_tail(&cb->list, &dev->ctrl_rd_list); in mei_cl_irq_notify()
1336 struct mei_cl_cb *cb; in mei_cl_notify_request() local
1361 cb = mei_cl_enqueue_ctrl_wr_cb(cl, 0, fop_type, fp); in mei_cl_notify_request()
1362 if (!cb) { in mei_cl_notify_request()
1372 list_move_tail(&cb->list, &dev->ctrl_rd_list); in mei_cl_notify_request()
1391 mei_io_cb_free(cb); in mei_cl_notify_request()
1486 struct mei_cl_cb *cb; in mei_cl_read_start() local
1509 cb = mei_cl_enqueue_ctrl_wr_cb(cl, length, MEI_FOP_READ, fp); in mei_cl_read_start()
1510 if (!cb) in mei_cl_read_start()
1526 list_move_tail(&cb->list, &cl->rd_pending); in mei_cl_read_start()
1536 mei_io_cb_free(cb); in mei_cl_read_start()
1547 static void mei_msg_hdr_init(struct mei_msg_hdr *mei_hdr, struct mei_cl_cb *cb) in mei_msg_hdr_init() argument
1549 mei_hdr->host_addr = mei_cl_host_addr(cb->cl); in mei_msg_hdr_init()
1550 mei_hdr->me_addr = mei_cl_me_id(cb->cl); in mei_msg_hdr_init()
1555 mei_hdr->internal = cb->internal; in mei_msg_hdr_init()
1568 int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, in mei_cl_irq_write() argument
1586 buf = &cb->buf; in mei_cl_irq_write()
1588 first_chunk = cb->buf_idx == 0; in mei_cl_irq_write()
1599 len = buf->size - cb->buf_idx; in mei_cl_irq_write()
1608 mei_msg_hdr_init(&mei_hdr, cb); in mei_cl_irq_write()
1624 cb->buf.size, cb->buf_idx); in mei_cl_irq_write()
1627 buf->data + cb->buf_idx, mei_hdr.length); in mei_cl_irq_write()
1633 cb->buf_idx += mei_hdr.length; in mei_cl_irq_write()
1643 list_move_tail(&cb->list, &dev->write_waiting_list); in mei_cl_irq_write()
1649 list_move_tail(&cb->list, cmpl_list); in mei_cl_irq_write()
1662 ssize_t mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb) in mei_cl_write() argument
1677 if (WARN_ON(!cb)) in mei_cl_write()
1682 buf = &cb->buf; in mei_cl_write()
1684 blocking = cb->blocking; in mei_cl_write()
1695 cb->buf_idx = 0; in mei_cl_write()
1703 mei_msg_hdr_init(&mei_hdr, cb); in mei_cl_write()
1742 cb->buf_idx = mei_hdr.length; in mei_cl_write()
1746 mei_tx_cb_enqueue(cb, &dev->write_waiting_list); in mei_cl_write()
1748 mei_tx_cb_enqueue(cb, &dev->write_list); in mei_cl_write()
1750 cb = NULL; in mei_cl_write()
1776 mei_io_cb_free(cb); in mei_cl_write()
1788 void mei_cl_complete(struct mei_cl *cl, struct mei_cl_cb *cb) in mei_cl_complete() argument
1792 switch (cb->fop_type) { in mei_cl_complete()
1794 mei_tx_cb_dequeue(cb); in mei_cl_complete()
1805 list_add_tail(&cb->list, &cl->rd_completed); in mei_cl_complete()
1822 mei_io_cb_free(cb); in mei_cl_complete()