Lines Matching refs:cb
131 struct mei_cl_cb *cb; in mei_amthif_find_read_list_entry() local
133 list_for_each_entry(cb, &dev->amthif_rd_complete_list.list, list) in mei_amthif_find_read_list_entry()
134 if (cb->file_object == file) in mei_amthif_find_read_list_entry()
135 return cb; in mei_amthif_find_read_list_entry()
160 struct mei_cl_cb *cb; in mei_amthif_read() local
172 cb = mei_amthif_find_read_list_entry(dev, file); in mei_amthif_read()
175 if (cb == NULL && file->f_flags & O_NONBLOCK) in mei_amthif_read()
180 while (cb == NULL) { in mei_amthif_read()
185 (cb = mei_amthif_find_read_list_entry(dev, file))); in mei_amthif_read()
200 if (cb) { in mei_amthif_read()
201 timeout = cb->read_time + in mei_amthif_read()
209 list_del(&cb->list); in mei_amthif_read()
215 if (cb->buf_idx >= *offset && length >= (cb->buf_idx - *offset)) in mei_amthif_read()
216 list_del(&cb->list); in mei_amthif_read()
217 else if (cb->buf_idx > 0 && cb->buf_idx <= *offset) { in mei_amthif_read()
219 list_del(&cb->list); in mei_amthif_read()
228 cb->response_buffer.size); in mei_amthif_read()
229 dev_dbg(dev->dev, "amthif cb->buf_idx - %lu\n", cb->buf_idx); in mei_amthif_read()
233 length = min_t(size_t, length, (cb->buf_idx - *offset)); in mei_amthif_read()
235 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) { in mei_amthif_read()
240 if ((*offset + length) < cb->buf_idx) { in mei_amthif_read()
248 mei_io_cb_free(cb); in mei_amthif_read()
262 static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb) in mei_amthif_send_cmd() argument
267 if (!dev || !cb) in mei_amthif_send_cmd()
273 dev->iamthif_current_cb = cb; in mei_amthif_send_cmd()
274 dev->iamthif_file_object = cb->file_object; in mei_amthif_send_cmd()
277 dev->iamthif_msg_buf_size = cb->request_buffer.size; in mei_amthif_send_cmd()
278 memcpy(dev->iamthif_msg_buf, cb->request_buffer.data, in mei_amthif_send_cmd()
279 cb->request_buffer.size); in mei_amthif_send_cmd()
287 if (cb->request_buffer.size > mei_hbuf_max_len(dev)) { in mei_amthif_send_cmd()
291 mei_hdr.length = cb->request_buffer.size; in mei_amthif_send_cmd()
310 dev->iamthif_current_cb = cb; in mei_amthif_send_cmd()
311 dev->iamthif_file_object = cb->file_object; in mei_amthif_send_cmd()
312 list_add_tail(&cb->list, &dev->write_waiting_list.list); in mei_amthif_send_cmd()
315 list_add_tail(&cb->list, &dev->write_list.list); in mei_amthif_send_cmd()
318 list_add_tail(&cb->list, &dev->write_list.list); in mei_amthif_send_cmd()
332 int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb) in mei_amthif_write() argument
336 if (!dev || !cb) in mei_amthif_write()
339 ret = mei_io_cb_alloc_resp_buf(cb, dev->iamthif_mtu); in mei_amthif_write()
343 cb->fop_type = MEI_FOP_WRITE; in mei_amthif_write()
350 list_add_tail(&cb->list, &dev->amthif_cmd_list.list); in mei_amthif_write()
353 return mei_amthif_send_cmd(dev, cb); in mei_amthif_write()
362 struct mei_cl_cb *cb; in mei_amthif_run_next_cmd() local
379 list_for_each_entry_safe(cb, next, &dev->amthif_cmd_list.list, list) { in mei_amthif_run_next_cmd()
380 list_del(&cb->list); in mei_amthif_run_next_cmd()
381 if (!cb->cl) in mei_amthif_run_next_cmd()
383 status = mei_amthif_send_cmd(dev, cb); in mei_amthif_run_next_cmd()
427 int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, in mei_amthif_irq_write() argument
474 list_del(&cb->list); in mei_amthif_irq_write()
489 cb->buf_idx = dev->iamthif_msg_buf_index; in mei_amthif_irq_write()
490 dev->iamthif_current_cb = cb; in mei_amthif_irq_write()
492 list_move_tail(&cb->list, &dev->write_waiting_list.list); in mei_amthif_irq_write()
513 struct mei_cl_cb *cb; in mei_amthif_irq_read_msg() local
536 cb = dev->iamthif_current_cb; in mei_amthif_irq_read_msg()
539 if (!cb->cl) in mei_amthif_irq_read_msg()
543 cb->buf_idx = dev->iamthif_msg_buf_index; in mei_amthif_irq_read_msg()
544 cb->read_time = jiffies; in mei_amthif_irq_read_msg()
549 list_add_tail(&cb->list, &complete_list->list); in mei_amthif_irq_read_msg()
592 void mei_amthif_complete(struct mei_device *dev, struct mei_cl_cb *cb) in mei_amthif_complete() argument
597 memcpy(cb->response_buffer.data, in mei_amthif_complete()
600 list_add_tail(&cb->list, &dev->amthif_rd_complete_list.list); in mei_amthif_complete()