/* remove all waiting requests */
list_for_each_entry_safe(cb_pos, cb_next, &dev->write_list.list, list) {
list_del(&cb_pos->list);
- mei_free_cb_private(cb_pos);
+ mei_io_cb_free(cb_pos);
}
}
mei_io_list_flush(&dev->ctrl_rd_list, cl);
mei_io_list_flush(&dev->ctrl_wr_list, cl);
free:
- mei_free_cb_private(cb);
+ mei_io_cb_free(cb);
return rets;
}
static void _mei_cmpl(struct mei_cl *cl, struct mei_cl_cb *cb_pos)
{
if (cb_pos->major_file_operations == MEI_WRITE) {
- mei_free_cb_private(cb_pos);
+ mei_io_cb_free(cb_pos);
cb_pos = NULL;
cl->writing_state = MEI_WRITE_COMPLETE;
if (waitqueue_active(&cl->tx_wait))
dev->iamthif_state = MEI_IAMTHIF_IDLE;
dev->iamthif_timer = 0;
- if (dev->iamthif_current_cb)
- mei_free_cb_private(dev->iamthif_current_cb);
+ mei_io_cb_free(dev->iamthif_current_cb);
+ dev->iamthif_current_cb = NULL;
dev->iamthif_file_object = NULL;
- dev->iamthif_current_cb = NULL;
mei_run_next_iamthif_cmd(dev);
}
}
if (cl_pos == &dev->iamthif_cl)
list_del(&cb_pos->list);
}
- if (dev->iamthif_current_cb)
- mei_free_cb_private(dev->iamthif_current_cb);
+ mei_io_cb_free(dev->iamthif_current_cb);
+ dev->iamthif_current_cb = NULL;
dev->iamthif_file_object->private_data = NULL;
dev->iamthif_file_object = NULL;
- dev->iamthif_current_cb = NULL;
dev->iamthif_timer = 0;
mei_run_next_iamthif_cmd(dev);
#include <linux/mei.h>
#include "interface.h"
+/**
+ * mei_io_cb_free - free mei_cb_private related memory
+ *
+ * @cb: mei callback struct
+ */
+void mei_io_cb_free(struct mei_cl_cb *cb)
+{
+ if (cb == NULL)
+ return;
+
+ kfree(cb->request_buffer.data);
+ kfree(cb->response_buffer.data);
+ kfree(cb);
+}
+
/**
* mei_me_cl_by_id return index to me_clients for client_id
*
rets = 0;
end:
dev_dbg(&dev->pdev->dev, "free connect cb memory.");
- kfree(cb);
+ mei_io_cb_free(cb);
return rets;
}
free:
dev_dbg(&dev->pdev->dev, "free amthi cb memory.\n");
*offset = 0;
- mei_free_cb_private(cb);
+ mei_io_cb_free(cb);
out:
return rets;
}
}
return rets;
unlock:
- mei_free_cb_private(cb);
+ mei_io_cb_free(cb);
return rets;
}
}
}
-/**
- * mei_free_cb_private - free mei_cb_private related memory
- *
- * @cb: mei callback struct
- */
-void mei_free_cb_private(struct mei_cl_cb *cb)
-{
- if (cb == NULL)
- return;
-
- kfree(cb->request_buffer.data);
- kfree(cb->response_buffer.data);
- kfree(cb);
-}
mei_send_flow_control(dev, &dev->iamthif_cl);
}
/* free all allocated buffers */
- mei_free_cb_private(cb_pos);
+ mei_io_cb_free(cb_pos);
cb_pos = NULL;
removed = true;
}
/* check file and iamthif current cb association */
if (dev->iamthif_current_cb->file_object == file) {
/* remove cb */
- mei_free_cb_private(dev->iamthif_current_cb);
+ mei_io_cb_free(dev->iamthif_current_cb);
dev->iamthif_current_cb = NULL;
removed = true;
}
file->private_data = NULL;
if (cb) {
- mei_free_cb_private(cb);
+ mei_io_cb_free(cb);
cb = NULL;
}
/* Remove entry from read list */
if (cb_pos)
list_del(&cb_pos->list);
- mei_free_cb_private(cb);
+ mei_io_cb_free(cb);
cl->reading_state = MEI_IDLE;
cl->read_cb = NULL;
cl->read_pending = 0;
cl->reading_state == MEI_READ_COMPLETE) {
*offset = 0;
list_del(&write_cb->list);
- mei_free_cb_private(write_cb);
+ mei_io_cb_free(write_cb);
write_cb = NULL;
}
}
write_cb = find_read_list_entry(dev, cl);
if (write_cb) {
list_del(&write_cb->list);
- mei_free_cb_private(write_cb);
+ mei_io_cb_free(write_cb);
write_cb = NULL;
cl->reading_state = MEI_IDLE;
cl->read_cb = NULL;
unlock_dev:
mutex_unlock(&dev->device_lock);
- mei_free_cb_private(write_cb);
+ mei_io_cb_free(write_cb);
return rets;
}
int mei_me_cl_by_id(struct mei_device *dev, u8 client_id);
/*
- * MEI IO List Functions
+ * MEI IO Functions
*/
+void mei_io_cb_free(struct mei_cl_cb *priv_cb);
+
/**
* mei_io_list_init - Sets up a queue list.
*
void mei_run_next_iamthif_cmd(struct mei_device *dev);
-void mei_free_cb_private(struct mei_cl_cb *priv_cb);
/*