Lines Matching refs:cb

131 	struct mei_cl_cb *cb;
133 list_for_each_entry(cb, &dev->amthif_rd_complete_list.list, list)
134 if (cb->file_object == file)
135 return cb;
160 struct mei_cl_cb *cb;
172 cb = mei_amthif_find_read_list_entry(dev, file);
175 if (cb == NULL && file->f_flags & O_NONBLOCK)
180 while (cb == NULL) {
185 (cb = mei_amthif_find_read_list_entry(dev, file)));
200 if (cb) {
201 timeout = cb->read_time +
209 list_del(&cb->list);
215 if (cb->buf_idx >= *offset && length >= (cb->buf_idx - *offset))
216 list_del(&cb->list);
217 else if (cb->buf_idx > 0 && cb->buf_idx <= *offset) {
219 list_del(&cb->list);
227 dev_dbg(dev->dev, "amthif cb->response_buffer size - %d\n",
228 cb->response_buffer.size);
229 dev_dbg(dev->dev, "amthif cb->buf_idx - %lu\n", cb->buf_idx);
233 length = min_t(size_t, length, (cb->buf_idx - *offset));
235 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) {
240 if ((*offset + length) < cb->buf_idx) {
246 dev_dbg(dev->dev, "free amthif cb memory.\n");
248 mei_io_cb_free(cb);
257 * @cb: mei call back struct
262 static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
267 if (!dev || !cb)
273 dev->iamthif_current_cb = cb;
274 dev->iamthif_file_object = cb->file_object;
277 dev->iamthif_msg_buf_size = cb->request_buffer.size;
278 memcpy(dev->iamthif_msg_buf, cb->request_buffer.data,
279 cb->request_buffer.size);
287 if (cb->request_buffer.size > mei_hbuf_max_len(dev)) {
291 mei_hdr.length = cb->request_buffer.size;
309 dev_dbg(dev->dev, "add amthif cb to write waiting list\n");
310 dev->iamthif_current_cb = cb;
311 dev->iamthif_file_object = cb->file_object;
312 list_add_tail(&cb->list, &dev->write_waiting_list.list);
314 dev_dbg(dev->dev, "message does not complete, so add amthif cb to write list.\n");
315 list_add_tail(&cb->list, &dev->write_list.list);
318 list_add_tail(&cb->list, &dev->write_list.list);
327 * @cb: mei call back struct
332 int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb)
336 if (!dev || !cb)
339 ret = mei_io_cb_alloc_resp_buf(cb, dev->iamthif_mtu);
343 cb->fop_type = MEI_FOP_WRITE;
349 dev_dbg(dev->dev, "AMTHIF: add cb to the wait list\n");
350 list_add_tail(&cb->list, &dev->amthif_cmd_list.list);
353 return mei_amthif_send_cmd(dev, cb);
362 struct mei_cl_cb *cb;
377 dev_dbg(dev->dev, "complete amthif cmd_list cb.\n");
379 list_for_each_entry_safe(cb, next, &dev->amthif_cmd_list.list, list) {
380 list_del(&cb->list);
381 if (!cb->cl)
383 status = mei_amthif_send_cmd(dev, cb);
408 dev_dbg(dev->dev, "run next amthif cb\n");
422 * @cb: callback block.
427 int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
474 list_del(&cb->list);
488 /* save iamthif cb sent to amthif client */
489 cb->buf_idx = dev->iamthif_msg_buf_index;
490 dev->iamthif_current_cb = cb;
492 list_move_tail(&cb->list, &dev->write_waiting_list.list);
513 struct mei_cl_cb *cb;
536 cb = dev->iamthif_current_cb;
539 if (!cb->cl)
543 cb->buf_idx = dev->iamthif_msg_buf_index;
544 cb->read_time = jiffies;
546 /* found the iamthif cb */
547 dev_dbg(dev->dev, "complete the amthif read cb.\n ");
548 dev_dbg(dev->dev, "add the amthif read cb to complete.\n ");
549 list_add_tail(&cb->list, &complete_list->list);
590 * @cb: callback block.
592 void mei_amthif_complete(struct mei_device *dev, struct mei_cl_cb *cb)
597 memcpy(cb->response_buffer.data,
600 list_add_tail(&cb->list, &dev->amthif_rd_complete_list.list);
639 /* check if cb equal to current iamthif cb */
688 /* check file and iamthif current cb association */
690 /* remove cb */
719 dev_dbg(dev->dev, "run next amthif iamthif cb\n");