memcpy(cb_pos->response_buffer.data,
dev->iamthif_msg_buf,
dev->iamthif_msg_buf_index);
- list_add_tail(&cb_pos->cb_list,
- &dev->amthi_read_complete_list.mei_cb.cb_list);
- dev_dbg(&dev->pdev->dev, "amthi read completed.\n");
+ list_add_tail(&cb_pos->list, &dev->amthi_read_complete_list.list);
+ dev_dbg(&dev->pdev->dev, "amthi read completed\n");
dev->iamthif_timer = jiffies;
dev_dbg(&dev->pdev->dev, "dev->iamthif_timer = %ld\n",
dev->iamthif_timer);
*
* returns 0 on success, <0 on failure.
*/
-static int mei_irq_thread_read_amthi_message(struct mei_io_list *complete_list,
+static int mei_irq_thread_read_amthi_message(struct mei_cl_cb *complete_list,
struct mei_device *dev,
struct mei_msg_hdr *mei_hdr)
{
/* found the iamthif cb */
dev_dbg(&dev->pdev->dev, "complete the amthi read cb.\n ");
dev_dbg(&dev->pdev->dev, "add the amthi read cb to complete.\n ");
- list_add_tail(&cb->cb_list,
- &complete_list->mei_cb.cb_list);
+ list_add_tail(&cb->list, &complete_list->list);
}
return 0;
}
*
* returns 0 on success, <0 on failure.
*/
-static int mei_irq_thread_read_client_message(struct mei_io_list *complete_list,
+static int mei_irq_thread_read_client_message(struct mei_cl_cb *complete_list,
struct mei_device *dev,
struct mei_msg_hdr *mei_hdr)
{
unsigned char *buffer = NULL;
dev_dbg(&dev->pdev->dev, "start client msg\n");
- if (list_empty(&dev->read_list.mei_cb.cb_list))
+ if (list_empty(&dev->read_list.list))
goto quit;
- list_for_each_entry_safe(cb_pos, cb_next,
- &dev->read_list.mei_cb.cb_list, cb_list) {
+ list_for_each_entry_safe(cb_pos, cb_next, &dev->read_list.list, list) {
cl = (struct mei_cl *)cb_pos->file_private;
if (cl && _mei_irq_thread_state_ok(cl, mei_hdr)) {
cl->reading_state = MEI_READING;
if (cb_pos->response_buffer.size <
mei_hdr->length + cb_pos->buf_idx) {
dev_dbg(&dev->pdev->dev, "message overflow.\n");
- list_del(&cb_pos->cb_list);
+ list_del(&cb_pos->list);
return -ENOMEM;
}
if (buffer)
cb_pos->buf_idx += mei_hdr->length;
if (mei_hdr->msg_complete) {
cl->status = 0;
- list_del(&cb_pos->cb_list);
+ list_del(&cb_pos->list);
dev_dbg(&dev->pdev->dev,
"completed read H cl = %d, ME cl = %d, length = %lu\n",
cl->host_client_id,
cl->me_client_id,
cb_pos->buf_idx);
- list_add_tail(&cb_pos->cb_list,
- &complete_list->mei_cb.cb_list);
+ list_add_tail(&cb_pos->list,
+ &complete_list->list);
}
break;
static int _mei_irq_thread_close(struct mei_device *dev, s32 *slots,
struct mei_cl_cb *cb_pos,
struct mei_cl *cl,
- struct mei_io_list *cmpl_list)
+ struct mei_cl_cb *cmpl_list)
{
if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) +
sizeof(struct hbm_client_disconnect_request)))
if (mei_disconnect(dev, cl)) {
cl->status = 0;
cb_pos->buf_idx = 0;
- list_move_tail(&cb_pos->cb_list,
- &cmpl_list->mei_cb.cb_list);
+ list_move_tail(&cb_pos->list, &cmpl_list->list);
return -EMSGSIZE;
} else {
cl->state = MEI_FILE_DISCONNECTING;
cl->status = 0;
cb_pos->buf_idx = 0;
- list_move_tail(&cb_pos->cb_list,
- &dev->ctrl_rd_list.mei_cb.cb_list);
+ list_move_tail(&cb_pos->list, &dev->ctrl_rd_list.list);
cl->timer_count = MEI_CONNECT_TIMEOUT;
}
{
struct mei_cl *cl;
- struct mei_cl_cb *cb_pos = NULL, *cb_next = NULL;
+ struct mei_cl_cb *pos = NULL, *next = NULL;
dev_dbg(&dev->pdev->dev,
"connect_response:\n"
dev->iamthif_state = MEI_IAMTHIF_IDLE;
return;
}
- list_for_each_entry_safe(cb_pos, cb_next,
- &dev->ctrl_rd_list.mei_cb.cb_list, cb_list) {
+ list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) {
- cl = (struct mei_cl *)cb_pos->file_private;
+ cl = (struct mei_cl *)pos->file_private;
if (!cl) {
- list_del(&cb_pos->cb_list);
+ list_del(&pos->list);
return;
}
- if (MEI_IOCTL == cb_pos->major_file_operations) {
+ if (MEI_IOCTL == pos->major_file_operations) {
if (is_treat_specially_client(cl, rs)) {
- list_del(&cb_pos->cb_list);
+ list_del(&pos->list);
cl->status = 0;
cl->timer_count = 0;
break;
struct hbm_client_connect_response *rs)
{
struct mei_cl *cl;
- struct mei_cl_cb *cb_pos = NULL, *cb_next = NULL;
+ struct mei_cl_cb *pos = NULL, *next = NULL;
dev_dbg(&dev->pdev->dev,
"disconnect_response:\n"
rs->host_addr,
rs->status);
- list_for_each_entry_safe(cb_pos, cb_next,
- &dev->ctrl_rd_list.mei_cb.cb_list, cb_list) {
- cl = (struct mei_cl *)cb_pos->file_private;
+ list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) {
+ cl = (struct mei_cl *)pos->file_private;
if (!cl) {
- list_del(&cb_pos->cb_list);
+ list_del(&pos->list);
return;
}
if (cl->host_client_id == rs->host_addr &&
cl->me_client_id == rs->me_addr) {
- list_del(&cb_pos->cb_list);
+ list_del(&pos->list);
if (!rs->status)
cl->state = MEI_FILE_DISCONNECTED;
static int _mei_irq_thread_read(struct mei_device *dev, s32 *slots,
struct mei_cl_cb *cb_pos,
struct mei_cl *cl,
- struct mei_io_list *cmpl_list)
+ struct mei_cl_cb *cmpl_list)
{
if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) +
sizeof(struct hbm_flow_control))) {
/* return the cancel routine */
- list_del(&cb_pos->cb_list);
+ list_del(&cb_pos->list);
return -EBADMSG;
}
if (mei_send_flow_control(dev, cl)) {
cl->status = -ENODEV;
cb_pos->buf_idx = 0;
- list_move_tail(&cb_pos->cb_list, &cmpl_list->mei_cb.cb_list);
+ list_move_tail(&cb_pos->list, &cmpl_list->list);
return -ENODEV;
}
- list_move_tail(&cb_pos->cb_list, &dev->read_list.mei_cb.cb_list);
+ list_move_tail(&cb_pos->list, &dev->read_list.list);
return 0;
}
static int _mei_irq_thread_ioctl(struct mei_device *dev, s32 *slots,
struct mei_cl_cb *cb_pos,
struct mei_cl *cl,
- struct mei_io_list *cmpl_list)
+ struct mei_cl_cb *cmpl_list)
{
if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) +
sizeof(struct hbm_client_connect_request))) {
/* return the cancel routine */
- list_del(&cb_pos->cb_list);
+ list_del(&cb_pos->list);
return -EBADMSG;
}
if (mei_connect(dev, cl)) {
cl->status = -ENODEV;
cb_pos->buf_idx = 0;
- list_del(&cb_pos->cb_list);
+ list_del(&cb_pos->list);
return -ENODEV;
} else {
- list_move_tail(&cb_pos->cb_list,
- &dev->ctrl_rd_list.mei_cb.cb_list);
+ list_move_tail(&cb_pos->list, &dev->ctrl_rd_list.list);
cl->timer_count = MEI_CONNECT_TIMEOUT;
}
return 0;
static int _mei_irq_thread_cmpl(struct mei_device *dev, s32 *slots,
struct mei_cl_cb *cb_pos,
struct mei_cl *cl,
- struct mei_io_list *cmpl_list)
+ struct mei_cl_cb *cmpl_list)
{
struct mei_msg_hdr *mei_hdr;
cb_pos->buf_idx),
mei_hdr->length)) {
cl->status = -ENODEV;
- list_move_tail(&cb_pos->cb_list,
- &cmpl_list->mei_cb.cb_list);
+ list_move_tail(&cb_pos->list, &cmpl_list->list);
return -ENODEV;
} else {
if (mei_flow_ctrl_reduce(dev, cl))
return -ENODEV;
cl->status = 0;
cb_pos->buf_idx += mei_hdr->length;
- list_move_tail(&cb_pos->cb_list,
- &dev->write_waiting_list.mei_cb.cb_list);
+ list_move_tail(&cb_pos->list, &dev->write_waiting_list.list);
}
} else if (*slots == dev->hbuf_depth) {
/* buffer is still empty */
cb_pos->buf_idx),
mei_hdr->length)) {
cl->status = -ENODEV;
- list_move_tail(&cb_pos->cb_list,
- &cmpl_list->mei_cb.cb_list);
+ list_move_tail(&cb_pos->list, &cmpl_list->list);
return -ENODEV;
} else {
cb_pos->buf_idx += mei_hdr->length;
static int _mei_irq_thread_cmpl_iamthif(struct mei_device *dev, s32 *slots,
struct mei_cl_cb *cb_pos,
struct mei_cl *cl,
- struct mei_io_list *cmpl_list)
+ struct mei_cl_cb *cmpl_list)
{
struct mei_msg_hdr *mei_hdr;
mei_hdr->length)) {
dev->iamthif_state = MEI_IAMTHIF_IDLE;
cl->status = -ENODEV;
- list_del(&cb_pos->cb_list);
+ list_del(&cb_pos->list);
return -ENODEV;
} else {
if (mei_flow_ctrl_reduce(dev, cl))
dev->iamthif_flow_control_pending = true;
/* save iamthif cb sent to amthi client */
dev->iamthif_current_cb = cb_pos;
- list_move_tail(&cb_pos->cb_list,
- &dev->write_waiting_list.mei_cb.cb_list);
+ list_move_tail(&cb_pos->list, &dev->write_waiting_list.list);
}
} else if (*slots == dev->hbuf_depth) {
dev->iamthif_msg_buf_index),
mei_hdr->length)) {
cl->status = -ENODEV;
- list_del(&cb_pos->cb_list);
+ list_del(&cb_pos->list);
} else {
dev->iamthif_msg_buf_index += mei_hdr->length;
}
*
* returns 0 on success, <0 on failure.
*/
-static int mei_irq_thread_read_handler(struct mei_io_list *cmpl_list,
+static int mei_irq_thread_read_handler(struct mei_cl_cb *cmpl_list,
struct mei_device *dev,
s32 *slots)
{
*
* returns 0 on success, <0 on failure.
*/
-static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,
- struct mei_device *dev,
- s32 *slots)
+static int mei_irq_thread_write_handler(struct mei_cl_cb *cmpl_list,
+ struct mei_device *dev, s32 *slots)
{
struct mei_cl *cl;
struct mei_cl_cb *pos = NULL, *next = NULL;
- struct mei_io_list *list;
+ struct mei_cl_cb *list;
int ret;
if (!mei_hbuf_is_empty(dev)) {
dev_dbg(&dev->pdev->dev, "complete all waiting for write cb.\n");
list = &dev->write_waiting_list;
- list_for_each_entry_safe(pos, next, &list->mei_cb.cb_list, cb_list) {
+ list_for_each_entry_safe(pos, next, &list->list, list) {
cl = (struct mei_cl *)pos->file_private;
if (cl == NULL)
continue;
cl->status = 0;
- list_del(&pos->cb_list);
+ list_del(&pos->list);
if (MEI_WRITING == cl->writing_state &&
(pos->major_file_operations == MEI_WRITE) &&
(cl != &dev->iamthif_cl)) {
dev_dbg(&dev->pdev->dev, "MEI WRITE COMPLETE\n");
cl->writing_state = MEI_WRITE_COMPLETE;
- list_add_tail(&pos->cb_list,
- &cmpl_list->mei_cb.cb_list);
+ list_add_tail(&pos->list, &cmpl_list->list);
}
if (cl == &dev->iamthif_cl) {
dev_dbg(&dev->pdev->dev, "check iamthif flow control.\n");
/* complete control write list CB */
dev_dbg(&dev->pdev->dev, "complete control write list cb.\n");
- list_for_each_entry_safe(pos, next,
- &dev->ctrl_wr_list.mei_cb.cb_list, cb_list) {
+ list_for_each_entry_safe(pos, next, &dev->ctrl_wr_list.list, list) {
cl = (struct mei_cl *) pos->file_private;
if (!cl) {
- list_del(&pos->cb_list);
+ list_del(&pos->list);
return -ENODEV;
}
switch (pos->major_file_operations) {
}
/* complete write list CB */
dev_dbg(&dev->pdev->dev, "complete write list cb.\n");
- list_for_each_entry_safe(pos, next,
- &dev->write_list.mei_cb.cb_list, cb_list) {
+ list_for_each_entry_safe(pos, next, &dev->write_list.list, list) {
cl = (struct mei_cl *)pos->file_private;
if (cl == NULL)
continue;
dev_dbg(&dev->pdev->dev, "freeing AMTHI for other requests\n");
- amthi_complete_list = &dev->amthi_read_complete_list.
- mei_cb.cb_list;
+ amthi_complete_list = &dev->amthi_read_complete_list.list;
- list_for_each_entry_safe(cb_pos, cb_next, amthi_complete_list, cb_list) {
+ list_for_each_entry_safe(cb_pos, cb_next, amthi_complete_list, list) {
cl_pos = cb_pos->file_object->private_data;
/* Finding the AMTHI entry. */
if (cl_pos == &dev->iamthif_cl)
- list_del(&cb_pos->cb_list);
+ list_del(&cb_pos->list);
}
if (dev->iamthif_current_cb)
mei_free_cb_private(dev->iamthif_current_cb);
irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)
{
struct mei_device *dev = (struct mei_device *) dev_id;
- struct mei_io_list complete_list;
+ struct mei_cl_cb complete_list;
struct mei_cl_cb *cb_pos = NULL, *cb_next = NULL;
struct mei_cl *cl;
s32 slots;
wake_up_interruptible(&dev->wait_recvd_msg);
bus_message_received = false;
}
- if (list_empty(&complete_list.mei_cb.cb_list))
+ if (list_empty(&complete_list.list))
return IRQ_HANDLED;
- list_for_each_entry_safe(cb_pos, cb_next,
- &complete_list.mei_cb.cb_list, cb_list) {
+ list_for_each_entry_safe(cb_pos, cb_next, &complete_list.list, list) {
cl = (struct mei_cl *)cb_pos->file_private;
- list_del(&cb_pos->cb_list);
+ list_del(&cb_pos->list);
if (cl) {
if (cl != &dev->iamthif_cl) {
dev_dbg(&dev->pdev->dev, "completing call back.\n");
rets = -ENOMEM;
goto end;
}
- INIT_LIST_HEAD(&cb->cb_list);
+ mei_io_list_init(cb);
cb->major_file_operations = MEI_IOCTL;
dev_dbg(&dev->pdev->dev, "Sending connect message - succeeded\n");
cl->timer_count = MEI_CONNECT_TIMEOUT;
cb->file_private = cl;
- list_add_tail(&cb->cb_list,
- &dev->ctrl_rd_list.mei_cb.
- cb_list);
+ list_add_tail(&cb->list, &dev->ctrl_rd_list.list);
}
dev_dbg(&dev->pdev->dev, "Queuing the connect request due to device busy\n");
cb->file_private = cl;
dev_dbg(&dev->pdev->dev, "add connect cb to control write list.\n");
- list_add_tail(&cb->cb_list,
- &dev->ctrl_wr_list.mei_cb.cb_list);
+ list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
}
mutex_unlock(&dev->device_lock);
err = wait_event_timeout(dev->wait_recvd_msg,
struct mei_cl_cb *next = NULL;
list_for_each_entry_safe(pos, next,
- &dev->amthi_read_complete_list.mei_cb.cb_list, cb_list) {
+ &dev->amthi_read_complete_list.list, list) {
cl_temp = (struct mei_cl *)pos->file_private;
if (cl_temp && cl_temp == &dev->iamthif_cl &&
pos->file_object == file)
if (time_after(jiffies, timeout)) {
dev_dbg(&dev->pdev->dev, "amthi Time out\n");
/* 15 sec for the message has expired */
- list_del(&cb->cb_list);
+ list_del(&cb->list);
rets = -ETIMEDOUT;
goto free;
}
}
/* if the whole message will fit remove it from the list */
if (cb->buf_idx >= *offset && length >= (cb->buf_idx - *offset))
- list_del(&cb->cb_list);
+ list_del(&cb->list);
else if (cb->buf_idx > 0 && cb->buf_idx <= *offset) {
/* end of the message has been reached */
- list_del(&cb->cb_list);
+ list_del(&cb->list);
rets = 0;
goto free;
}
rets = -ENODEV;
goto unlock;
}
- list_add_tail(&cb->cb_list, &dev->read_list.mei_cb.cb_list);
+ list_add_tail(&cb->list, &dev->read_list.list);
} else {
- list_add_tail(&cb->cb_list, &dev->ctrl_wr_list.mei_cb.cb_list);
+ list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
}
return rets;
unlock:
dev_dbg(&dev->pdev->dev, "add amthi cb to write waiting list\n");
dev->iamthif_current_cb = cb;
dev->iamthif_file_object = cb->file_object;
- list_add_tail(&cb->cb_list,
- &dev->write_waiting_list.mei_cb.cb_list);
+ list_add_tail(&cb->list, &dev->write_waiting_list.list);
} else {
dev_dbg(&dev->pdev->dev, "message does not complete, "
"so add amthi cb to write list.\n");
- list_add_tail(&cb->cb_list,
- &dev->write_list.mei_cb.cb_list);
+ list_add_tail(&cb->list, &dev->write_list.list);
}
} else {
if (!(dev->mei_host_buffer_is_empty))
dev_dbg(&dev->pdev->dev, "No flow control credentials, "
"so add iamthif cb to write list.\n");
- list_add_tail(&cb->cb_list, &dev->write_list.mei_cb.cb_list);
+ list_add_tail(&cb->list, &dev->write_list.list);
}
return 0;
}
dev_dbg(&dev->pdev->dev, "complete amthi cmd_list cb.\n");
- list_for_each_entry_safe(pos, next,
- &dev->amthi_cmd_list.mei_cb.cb_list, cb_list) {
- list_del(&pos->cb_list);
+ list_for_each_entry_safe(pos, next, &dev->amthi_cmd_list.list, list) {
+ list_del(&pos->list);
cl_tmp = (struct mei_cl *)pos->file_private;
if (cl_tmp && cl_tmp == &dev->iamthif_cl) {
bool removed = false;
/* list all list member */
- list_for_each_entry_safe(cb_pos, cb_next, mei_cb_list, cb_list) {
+ list_for_each_entry_safe(cb_pos, cb_next, mei_cb_list, list) {
file_temp = (struct file *)cb_pos->file_object;
/* check if list member associated with a file */
if (file_temp == file) {
/* remove member from the list */
- list_del(&cb_pos->cb_list);
+ list_del(&cb_pos->list);
/* check if cb equal to current iamthif cb */
if (dev->iamthif_current_cb == cb_pos) {
dev->iamthif_current_cb = NULL;
bool removed = false;
/* remove callbacks associated with a file */
- mei_clear_list(dev, file, &dev->amthi_cmd_list.mei_cb.cb_list);
+ mei_clear_list(dev, file, &dev->amthi_cmd_list.list);
if (mei_clear_list(dev, file,
- &dev->amthi_read_complete_list.mei_cb.cb_list))
+ &dev->amthi_read_complete_list.list))
removed = true;
- mei_clear_list(dev, file, &dev->ctrl_rd_list.mei_cb.cb_list);
+ mei_clear_list(dev, file, &dev->ctrl_rd_list.list);
- if (mei_clear_list(dev, file, &dev->ctrl_wr_list.mei_cb.cb_list))
+ if (mei_clear_list(dev, file, &dev->ctrl_wr_list.list))
removed = true;
- if (mei_clear_list(dev, file, &dev->write_waiting_list.mei_cb.cb_list))
+ if (mei_clear_list(dev, file, &dev->write_waiting_list.list))
removed = true;
- if (mei_clear_list(dev, file, &dev->write_list.mei_cb.cb_list))
+ if (mei_clear_list(dev, file, &dev->write_list.list))
removed = true;
/* check if iamthif_current_cb not NULL */
struct mei_cl_cb *next = NULL;
dev_dbg(&dev->pdev->dev, "remove read_list CB\n");
- list_for_each_entry_safe(pos, next,
- &dev->read_list.mei_cb.cb_list, cb_list) {
+ list_for_each_entry_safe(pos, next, &dev->read_list.list, list) {
struct mei_cl *cl_temp;
cl_temp = (struct mei_cl *)pos->file_private;
cb = find_read_list_entry(dev, cl);
/* Remove entry from read list */
if (cb)
- list_del(&cb->cb_list);
+ list_del(&cb->list);
cb = cl->read_cb;
cl->read_cb = NULL;
cb_pos = find_read_list_entry(dev, cl);
/* Remove entry from read list */
if (cb_pos)
- list_del(&cb_pos->cb_list);
+ list_del(&cb_pos->list);
mei_free_cb_private(cb);
cl->reading_state = MEI_IDLE;
cl->read_cb = NULL;
if (!cb)
return NULL;
- INIT_LIST_HEAD(&cb->cb_list);
+ mei_io_list_init(cb);
cb->file_object = fp;
cb->file_private = cl;
if (time_after(jiffies, timeout) ||
cl->reading_state == MEI_READ_COMPLETE) {
*offset = 0;
- list_del(&write_cb->cb_list);
+ list_del(&write_cb->list);
mei_free_cb_private(write_cb);
write_cb = NULL;
}
*offset = 0;
write_cb = find_read_list_entry(dev, cl);
if (write_cb) {
- list_del(&write_cb->cb_list);
+ list_del(&write_cb->list);
mei_free_cb_private(write_cb);
write_cb = NULL;
cl->reading_state = MEI_IDLE;
write_cb->major_file_operations = MEI_IOCTL;
- if (!list_empty(&dev->amthi_cmd_list.mei_cb.cb_list) ||
+ if (!list_empty(&dev->amthi_cmd_list.list) ||
dev->iamthif_state != MEI_IAMTHIF_IDLE) {
dev_dbg(&dev->pdev->dev, "amthi_state = %d\n",
(int) dev->iamthif_state);
dev_dbg(&dev->pdev->dev, "add amthi cb to amthi cmd waiting list\n");
- list_add_tail(&write_cb->cb_list,
- &dev->amthi_cmd_list.mei_cb.cb_list);
+ list_add_tail(&write_cb->list, &dev->amthi_cmd_list.list);
} else {
dev_dbg(&dev->pdev->dev, "call amthi write\n");
rets = amthi_write(dev, write_cb);
rets = -ENODEV;
goto unlock_dev;
}
- list_add_tail(&write_cb->cb_list,
- &dev->write_waiting_list.mei_cb.cb_list);
+ list_add_tail(&write_cb->list, &dev->write_waiting_list.list);
} else {
- list_add_tail(&write_cb->cb_list,
- &dev->write_list.mei_cb.cb_list);
+ list_add_tail(&write_cb->list, &dev->write_list.list);
}
} else {
write_cb->buf_idx = 0;
cl->writing_state = MEI_WRITING;
- list_add_tail(&write_cb->cb_list,
- &dev->write_list.mei_cb.cb_list);
+ list_add_tail(&write_cb->list, &dev->write_list.list);
}
mutex_unlock(&dev->device_lock);
return length;