return -ENODEV;
dev->iamthif_stall_timer = 0;
- cb->information = dev->iamthif_msg_buf_index;
+ cb->buf_idx = dev->iamthif_msg_buf_index;
cb->read_time = jiffies;
if (dev->iamthif_ioctl && cl == &dev->iamthif_cl) {
/* found the iamthif cb */
cl = (struct mei_cl *)cb_pos->file_private;
if (cl && _mei_irq_thread_state_ok(cl, mei_hdr)) {
cl->reading_state = MEI_READING;
- buffer = cb_pos->response_buffer.data + cb_pos->information;
+ buffer = cb_pos->response_buffer.data + cb_pos->buf_idx;
if (cb_pos->response_buffer.size <
- mei_hdr->length + cb_pos->information) {
+ mei_hdr->length + cb_pos->buf_idx) {
dev_dbg(&dev->pdev->dev, "message overflow.\n");
list_del(&cb_pos->cb_list);
return -ENOMEM;
if (buffer)
mei_read_slots(dev, buffer, mei_hdr->length);
- cb_pos->information += mei_hdr->length;
+ cb_pos->buf_idx += mei_hdr->length;
if (mei_hdr->msg_complete) {
cl->status = 0;
list_del(&cb_pos->cb_list);
"completed read H cl = %d, ME cl = %d, length = %lu\n",
cl->host_client_id,
cl->me_client_id,
- cb_pos->information);
+ cb_pos->buf_idx);
+
list_add_tail(&cb_pos->cb_list,
&complete_list->mei_cb.cb_list);
}
if (mei_disconnect(dev, cl)) {
cl->status = 0;
- cb_pos->information = 0;
+ cb_pos->buf_idx = 0;
list_move_tail(&cb_pos->cb_list,
&cmpl_list->mei_cb.cb_list);
return -EMSGSIZE;
} else {
cl->state = MEI_FILE_DISCONNECTING;
cl->status = 0;
- cb_pos->information = 0;
+ cb_pos->buf_idx = 0;
list_move_tail(&cb_pos->cb_list,
&dev->ctrl_rd_list.mei_cb.cb_list);
cl->timer_count = MEI_CONNECT_TIMEOUT;
if (mei_send_flow_control(dev, cl)) {
cl->status = -ENODEV;
- cb_pos->information = 0;
+ cb_pos->buf_idx = 0;
list_move_tail(&cb_pos->cb_list, &cmpl_list->mei_cb.cb_list);
return -ENODEV;
}
*slots -= mei_data2slots(sizeof(struct hbm_client_connect_request));
if (mei_connect(dev, cl)) {
cl->status = -ENODEV;
- cb_pos->information = 0;
+ cb_pos->buf_idx = 0;
list_del(&cb_pos->cb_list);
return -ENODEV;
} else {
struct mei_msg_hdr *mei_hdr;
if ((*slots * sizeof(u32)) >= (sizeof(struct mei_msg_hdr) +
- (cb_pos->request_buffer.size -
- cb_pos->information))) {
+ (cb_pos->request_buffer.size - cb_pos->buf_idx))) {
mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0];
mei_hdr->host_addr = cl->host_client_id;
mei_hdr->me_addr = cl->me_client_id;
- mei_hdr->length = cb_pos->request_buffer.size -
- cb_pos->information;
+ mei_hdr->length = cb_pos->request_buffer.size - cb_pos->buf_idx;
mei_hdr->msg_complete = 1;
mei_hdr->reserved = 0;
dev_dbg(&dev->pdev->dev, "cb_pos->request_buffer.size =%d"
"mei_hdr->msg_complete = %d\n",
cb_pos->request_buffer.size,
mei_hdr->msg_complete);
- dev_dbg(&dev->pdev->dev, "cb_pos->information =%lu\n",
- cb_pos->information);
+ dev_dbg(&dev->pdev->dev, "cb_pos->buf_idx =%lu\n",
+ cb_pos->buf_idx);
dev_dbg(&dev->pdev->dev, "mei_hdr->length =%d\n",
mei_hdr->length);
*slots -= mei_data2slots(mei_hdr->length);
if (mei_write_message(dev, mei_hdr,
(unsigned char *)
(cb_pos->request_buffer.data +
- cb_pos->information),
+ cb_pos->buf_idx),
mei_hdr->length)) {
cl->status = -ENODEV;
list_move_tail(&cb_pos->cb_list,
if (mei_flow_ctrl_reduce(dev, cl))
return -ENODEV;
cl->status = 0;
- cb_pos->information += mei_hdr->length;
+ cb_pos->buf_idx += mei_hdr->length;
list_move_tail(&cb_pos->cb_list,
&dev->write_waiting_list.mei_cb.cb_list);
}
if (mei_write_message(dev, mei_hdr,
(unsigned char *)
(cb_pos->request_buffer.data +
- cb_pos->information),
+ cb_pos->buf_idx),
mei_hdr->length)) {
cl->status = -ENODEV;
list_move_tail(&cb_pos->cb_list,
&cmpl_list->mei_cb.cb_list);
return -ENODEV;
} else {
- cb_pos->information += mei_hdr->length;
+ cb_pos->buf_idx += mei_hdr->length;
dev_dbg(&dev->pdev->dev,
"cb_pos->request_buffer.size =%d"
" mei_hdr->msg_complete = %d\n",
cb_pos->request_buffer.size,
mei_hdr->msg_complete);
- dev_dbg(&dev->pdev->dev, "cb_pos->information =%lu\n",
- cb_pos->information);
+ dev_dbg(&dev->pdev->dev, "cb_pos->buf_idx =%lu\n",
+ cb_pos->buf_idx);
dev_dbg(&dev->pdev->dev, "mei_hdr->length =%d\n",
mei_hdr->length);
}
if (mei_flow_ctrl_reduce(dev, cl))
return -ENODEV;
dev->iamthif_msg_buf_index += mei_hdr->length;
- cb_pos->information = dev->iamthif_msg_buf_index;
+ cb_pos->buf_idx = dev->iamthif_msg_buf_index;
cl->status = 0;
dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL;
dev->iamthif_flow_control_pending = true;
}
}
/* if the whole message will fit remove it from the list */
- if (cb->information >= *offset && length >= (cb->information - *offset))
+ if (cb->buf_idx >= *offset && length >= (cb->buf_idx - *offset))
list_del(&cb->cb_list);
- else if (cb->information > 0 && cb->information <= *offset) {
+ else if (cb->buf_idx > 0 && cb->buf_idx <= *offset) {
/* end of the message has been reached */
list_del(&cb->cb_list);
rets = 0;
dev_dbg(&dev->pdev->dev, "amthi cb->response_buffer size - %d\n",
cb->response_buffer.size);
- dev_dbg(&dev->pdev->dev, "amthi cb->information - %lu\n",
- cb->information);
+ dev_dbg(&dev->pdev->dev, "amthi cb->buf_idx - %lu\n", cb->buf_idx);
/* length is being turncated to PAGE_SIZE, however,
- * the information may be longer */
- length = min_t(size_t, length, (cb->information - *offset));
+ * the buf_idx may point beyond */
+ length = min_t(size_t, length, (cb->buf_idx - *offset));
if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length))
rets = -EFAULT;
else {
rets = length;
- if ((*offset + length) < cb->information) {
+ if ((*offset + length) < cb->buf_idx) {
*offset += length;
goto out;
}
}
dev_dbg(&dev->pdev->dev, "allocation call back data success.\n");
cb->major_file_operations = MEI_READ;
- /* make sure information is zero before we start */
- cb->information = 0;
+ /* make sure buffer index is zero before we start */
+ cb->buf_idx = 0;
cb->file_private = (void *) cl;
cl->read_cb = cb;
if (dev->mei_host_buffer_is_empty) {
goto out;
}
- if (cl->read_cb && cl->read_cb->information > *offset) {
+ if (cl->read_cb && cl->read_cb->buf_idx > *offset) {
cb = cl->read_cb;
goto copy_buffer;
- } else if (cl->read_cb && cl->read_cb->information > 0 &&
- cl->read_cb->information <= *offset) {
+ } else if (cl->read_cb && cl->read_cb->buf_idx > 0 &&
+ cl->read_cb->buf_idx <= *offset) {
cb = cl->read_cb;
rets = 0;
goto free;
- } else if ((!cl->read_cb || !cl->read_cb->information) &&
- *offset > 0) {
+ } else if ((!cl->read_cb || !cl->read_cb->buf_idx) && *offset > 0) {
/*Offset needs to be cleaned for contiguous reads*/
*offset = 0;
rets = 0;
copy_buffer:
dev_dbg(&dev->pdev->dev, "cb->response_buffer size - %d\n",
cb->response_buffer.size);
- dev_dbg(&dev->pdev->dev, "cb->information - %lu\n",
- cb->information);
- if (length == 0 || ubuf == NULL || *offset > cb->information) {
+ dev_dbg(&dev->pdev->dev, "cb->buf_idx - %lu\n", cb->buf_idx);
+ if (length == 0 || ubuf == NULL || *offset > cb->buf_idx) {
rets = -EMSGSIZE;
goto free;
}
- /* length is being truncated to PAGE_SIZE, however, */
- /* information size may be longer */
- length = min_t(size_t, length, (cb->information - *offset));
+ /* length is being truncated to PAGE_SIZE,
+ * however buf_idx may point beyond that */
+ length = min_t(size_t, length, cb->buf_idx - *offset);
if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) {
rets = -EFAULT;
rets = length;
*offset += length;
- if ((unsigned long)*offset < cb->information)
+ if ((unsigned long)*offset < cb->buf_idx)
goto out;
free:
write_cb->response_buffer.size = dev->iamthif_mtu;
write_cb->major_file_operations = MEI_IOCTL;
- write_cb->information = 0;
+ write_cb->buf_idx = 0;
write_cb->request_buffer.size = length;
if (dev->iamthif_cl.state != MEI_FILE_CONNECTED) {
rets = -ENODEV;
}
write_cb->major_file_operations = MEI_WRITE;
- /* make sure information is zero before we start */
-
- write_cb->information = 0;
+ /* make sure buffer index is zero before we start */
+ write_cb->buf_idx = 0;
write_cb->request_buffer.size = length;
dev_dbg(&dev->pdev->dev, "host client = %d, ME client = %d\n",
goto unlock_dev;
}
cl->writing_state = MEI_WRITING;
- write_cb->information = mei_hdr.length;
+ write_cb->buf_idx = mei_hdr.length;
if (mei_hdr.msg_complete) {
if (mei_flow_ctrl_reduce(dev, cl)) {
rets = -ENODEV;
} else {
- write_cb->information = 0;
+ write_cb->buf_idx = 0;
cl->writing_state = MEI_WRITING;
list_add_tail(&write_cb->cb_list,
&dev->write_list.mei_cb.cb_list);