struct mei_cl_cb *mei_amthif_find_read_list_entry(struct mei_device *dev,
struct file *file)
{
- struct mei_cl *cl_temp;
struct mei_cl_cb *pos = NULL;
struct mei_cl_cb *next = NULL;
list_for_each_entry_safe(pos, next,
&dev->amthif_rd_complete_list.list, list) {
- cl_temp = (struct mei_cl *)pos->file_private;
- if (cl_temp && cl_temp == &dev->iamthif_cl &&
+ if (pos->cl && pos->cl == &dev->iamthif_cl &&
pos->file_object == file)
return pos;
}
*/
void mei_amthif_run_next_cmd(struct mei_device *dev)
{
- struct mei_cl *cl_tmp;
struct mei_cl_cb *pos = NULL;
struct mei_cl_cb *next = NULL;
int status;
list_for_each_entry_safe(pos, next, &dev->amthif_cmd_list.list, list) {
list_del(&pos->list);
- cl_tmp = (struct mei_cl *)pos->file_private;
- if (cl_tmp && cl_tmp == &dev->iamthif_cl) {
+ if (pos->cl && pos->cl == &dev->iamthif_cl) {
status = mei_amthif_send_cmd(dev, pos);
if (status) {
dev_dbg(&dev->pdev->dev,
int mei_amthif_irq_read_message(struct mei_cl_cb *complete_list,
struct mei_device *dev, struct mei_msg_hdr *mei_hdr)
{
- struct mei_cl *cl;
struct mei_cl_cb *cb;
unsigned char *buffer;
cb = dev->iamthif_current_cb;
dev->iamthif_current_cb = NULL;
- cl = (struct mei_cl *)cb->file_private;
- if (!cl)
+ if (!cb->cl)
return -ENODEV;
dev->iamthif_stall_timer = 0;
cb->buf_idx = dev->iamthif_msg_buf_index;
cb->read_time = jiffies;
- if (dev->iamthif_ioctl && cl == &dev->iamthif_cl) {
+ if (dev->iamthif_ioctl && cb->cl == &dev->iamthif_cl) {
/* 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 ");
struct mei_cl_cb *next;
list_for_each_entry_safe(pos, next, &list->list, list) {
- if (pos->file_private) {
- struct mei_cl *cl_tmp;
- cl_tmp = (struct mei_cl *)pos->file_private;
- if (mei_cl_cmp_id(cl, cl_tmp))
+ if (pos->cl) {
+ if (mei_cl_cmp_id(cl, pos->cl))
list_del(&pos->list);
}
}
goto quit;
list_for_each_entry_safe(cb_pos, cb_next, &dev->read_list.list, list) {
- cl = (struct mei_cl *)cb_pos->file_private;
+ cl = cb_pos->cl;
if (cl && _mei_irq_thread_state_ok(cl, mei_hdr)) {
cl->reading_state = MEI_READING;
buffer = cb_pos->response_buffer.data + cb_pos->buf_idx;
}
list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) {
- cl = (struct mei_cl *)pos->file_private;
+ cl = pos->cl;
if (!cl) {
list_del(&pos->list);
return;
rs->status);
list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) {
- cl = (struct mei_cl *)pos->file_private;
+ cl = pos->cl;
if (!cl) {
list_del(&pos->list);
list = &dev->write_waiting_list;
list_for_each_entry_safe(pos, next, &list->list, list) {
- cl = (struct mei_cl *)pos->file_private;
+ cl = pos->cl;
if (cl == NULL)
continue;
/* 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.list, list) {
- cl = (struct mei_cl *) pos->file_private;
+ cl = pos->cl;
if (!cl) {
list_del(&pos->list);
return -ENODEV;
/* complete write list CB */
dev_dbg(&dev->pdev->dev, "complete write list cb.\n");
list_for_each_entry_safe(pos, next, &dev->write_list.list, list) {
- cl = (struct mei_cl *)pos->file_private;
+ cl = pos->cl;
if (cl == NULL)
continue;
list_for_each_entry_safe(cb_pos, cb_next, &complete_list.list, list) {
- cl = (struct mei_cl *)cb_pos->file_private;
+ cl = cb_pos->cl;
list_del(&cb_pos->list);
if (cl) {
if (cl != &dev->iamthif_cl) {
mei_io_list_init(cb);
cb->file_object = fp;
- cb->file_private = cl;
+ cb->cl = cl;
cb->buf_idx = 0;
return cb;
}
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.list, list) {
- struct mei_cl *cl_temp;
- cl_temp = (struct mei_cl *)pos->file_private;
-
- if (mei_cl_cmp_id(cl, cl_temp))
+ list_for_each_entry_safe(pos, next, &dev->read_list.list, list)
+ if (mei_cl_cmp_id(cl, pos->cl))
return pos;
- }
return NULL;
}
};
+struct mei_cl;
+
+/*
+ * struct mei_cl_cb - file operation callback structure
+ *
+ * @cl - file client who is running this operation
+ */
struct mei_cl_cb {
struct list_head list;
+ struct mei_cl *cl;
enum mei_cb_major_types major_file_operations;
- void *file_private;
struct mei_message_data request_buffer;
struct mei_message_data response_buffer;
unsigned long buf_idx;