Commit 601a1efa authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

mei: rename mei_free_cb_private to mei_io_cb_free

1. cb_private was an old name that we depriacated in earlier
cleanups

2. we also group the funcion declaration with other _io_
functions

3. Don't check cb for NULL as mei_io_cb_free is NULL safe
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fb601adb
...@@ -341,7 +341,7 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) ...@@ -341,7 +341,7 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
/* remove all waiting requests */ /* remove all waiting requests */
list_for_each_entry_safe(cb_pos, cb_next, &dev->write_list.list, list) { list_for_each_entry_safe(cb_pos, cb_next, &dev->write_list.list, list) {
list_del(&cb_pos->list); list_del(&cb_pos->list);
mei_free_cb_private(cb_pos); mei_io_cb_free(cb_pos);
} }
} }
...@@ -715,7 +715,7 @@ int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl) ...@@ -715,7 +715,7 @@ int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl)
mei_io_list_flush(&dev->ctrl_rd_list, cl); mei_io_list_flush(&dev->ctrl_rd_list, cl);
mei_io_list_flush(&dev->ctrl_wr_list, cl); mei_io_list_flush(&dev->ctrl_wr_list, cl);
free: free:
mei_free_cb_private(cb); mei_io_cb_free(cb);
return rets; return rets;
} }
......
...@@ -58,7 +58,7 @@ irqreturn_t mei_interrupt_quick_handler(int irq, void *dev_id) ...@@ -58,7 +58,7 @@ irqreturn_t mei_interrupt_quick_handler(int irq, void *dev_id)
static void _mei_cmpl(struct mei_cl *cl, struct mei_cl_cb *cb_pos) static void _mei_cmpl(struct mei_cl *cl, struct mei_cl_cb *cb_pos)
{ {
if (cb_pos->major_file_operations == MEI_WRITE) { if (cb_pos->major_file_operations == MEI_WRITE) {
mei_free_cb_private(cb_pos); mei_io_cb_free(cb_pos);
cb_pos = NULL; cb_pos = NULL;
cl->writing_state = MEI_WRITE_COMPLETE; cl->writing_state = MEI_WRITE_COMPLETE;
if (waitqueue_active(&cl->tx_wait)) if (waitqueue_active(&cl->tx_wait))
...@@ -1368,11 +1368,10 @@ void mei_timer(struct work_struct *work) ...@@ -1368,11 +1368,10 @@ void mei_timer(struct work_struct *work)
dev->iamthif_state = MEI_IAMTHIF_IDLE; dev->iamthif_state = MEI_IAMTHIF_IDLE;
dev->iamthif_timer = 0; dev->iamthif_timer = 0;
if (dev->iamthif_current_cb) mei_io_cb_free(dev->iamthif_current_cb);
mei_free_cb_private(dev->iamthif_current_cb); dev->iamthif_current_cb = NULL;
dev->iamthif_file_object = NULL; dev->iamthif_file_object = NULL;
dev->iamthif_current_cb = NULL;
mei_run_next_iamthif_cmd(dev); mei_run_next_iamthif_cmd(dev);
} }
} }
...@@ -1404,12 +1403,11 @@ void mei_timer(struct work_struct *work) ...@@ -1404,12 +1403,11 @@ void mei_timer(struct work_struct *work)
if (cl_pos == &dev->iamthif_cl) if (cl_pos == &dev->iamthif_cl)
list_del(&cb_pos->list); list_del(&cb_pos->list);
} }
if (dev->iamthif_current_cb) mei_io_cb_free(dev->iamthif_current_cb);
mei_free_cb_private(dev->iamthif_current_cb); dev->iamthif_current_cb = NULL;
dev->iamthif_file_object->private_data = NULL; dev->iamthif_file_object->private_data = NULL;
dev->iamthif_file_object = NULL; dev->iamthif_file_object = NULL;
dev->iamthif_current_cb = NULL;
dev->iamthif_timer = 0; dev->iamthif_timer = 0;
mei_run_next_iamthif_cmd(dev); mei_run_next_iamthif_cmd(dev);
......
...@@ -38,6 +38,21 @@ ...@@ -38,6 +38,21 @@
#include <linux/mei.h> #include <linux/mei.h>
#include "interface.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 * mei_me_cl_by_id return index to me_clients for client_id
* *
...@@ -231,7 +246,7 @@ int mei_ioctl_connect_client(struct file *file, ...@@ -231,7 +246,7 @@ int mei_ioctl_connect_client(struct file *file,
rets = 0; rets = 0;
end: end:
dev_dbg(&dev->pdev->dev, "free connect cb memory."); dev_dbg(&dev->pdev->dev, "free connect cb memory.");
kfree(cb); mei_io_cb_free(cb);
return rets; return rets;
} }
...@@ -375,7 +390,7 @@ int amthi_read(struct mei_device *dev, struct file *file, ...@@ -375,7 +390,7 @@ int amthi_read(struct mei_device *dev, struct file *file,
free: free:
dev_dbg(&dev->pdev->dev, "free amthi cb memory.\n"); dev_dbg(&dev->pdev->dev, "free amthi cb memory.\n");
*offset = 0; *offset = 0;
mei_free_cb_private(cb); mei_io_cb_free(cb);
out: out:
return rets; return rets;
} }
...@@ -444,7 +459,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl) ...@@ -444,7 +459,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl)
} }
return rets; return rets;
unlock: unlock:
mei_free_cb_private(cb); mei_io_cb_free(cb);
return rets; return rets;
} }
...@@ -568,17 +583,3 @@ void mei_run_next_iamthif_cmd(struct mei_device *dev) ...@@ -568,17 +583,3 @@ void mei_run_next_iamthif_cmd(struct mei_device *dev)
} }
} }
/**
* 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);
}
...@@ -124,7 +124,7 @@ static bool mei_clear_list(struct mei_device *dev, ...@@ -124,7 +124,7 @@ static bool mei_clear_list(struct mei_device *dev,
mei_send_flow_control(dev, &dev->iamthif_cl); mei_send_flow_control(dev, &dev->iamthif_cl);
} }
/* free all allocated buffers */ /* free all allocated buffers */
mei_free_cb_private(cb_pos); mei_io_cb_free(cb_pos);
cb_pos = NULL; cb_pos = NULL;
removed = true; removed = true;
} }
...@@ -169,7 +169,7 @@ static bool mei_clear_lists(struct mei_device *dev, struct file *file) ...@@ -169,7 +169,7 @@ static bool mei_clear_lists(struct mei_device *dev, struct file *file)
/* check file and iamthif current cb association */ /* check file and iamthif current cb association */
if (dev->iamthif_current_cb->file_object == file) { if (dev->iamthif_current_cb->file_object == file) {
/* remove cb */ /* remove cb */
mei_free_cb_private(dev->iamthif_current_cb); mei_io_cb_free(dev->iamthif_current_cb);
dev->iamthif_current_cb = NULL; dev->iamthif_current_cb = NULL;
removed = true; removed = true;
} }
...@@ -332,7 +332,7 @@ static int mei_release(struct inode *inode, struct file *file) ...@@ -332,7 +332,7 @@ static int mei_release(struct inode *inode, struct file *file)
file->private_data = NULL; file->private_data = NULL;
if (cb) { if (cb) {
mei_free_cb_private(cb); mei_io_cb_free(cb);
cb = NULL; cb = NULL;
} }
...@@ -504,7 +504,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, ...@@ -504,7 +504,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
/* Remove entry from read list */ /* Remove entry from read list */
if (cb_pos) if (cb_pos)
list_del(&cb_pos->list); list_del(&cb_pos->list);
mei_free_cb_private(cb); mei_io_cb_free(cb);
cl->reading_state = MEI_IDLE; cl->reading_state = MEI_IDLE;
cl->read_cb = NULL; cl->read_cb = NULL;
cl->read_pending = 0; cl->read_pending = 0;
...@@ -651,7 +651,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, ...@@ -651,7 +651,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
cl->reading_state == MEI_READ_COMPLETE) { cl->reading_state == MEI_READ_COMPLETE) {
*offset = 0; *offset = 0;
list_del(&write_cb->list); list_del(&write_cb->list);
mei_free_cb_private(write_cb); mei_io_cb_free(write_cb);
write_cb = NULL; write_cb = NULL;
} }
} }
...@@ -663,7 +663,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, ...@@ -663,7 +663,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
write_cb = find_read_list_entry(dev, cl); write_cb = find_read_list_entry(dev, cl);
if (write_cb) { if (write_cb) {
list_del(&write_cb->list); list_del(&write_cb->list);
mei_free_cb_private(write_cb); mei_io_cb_free(write_cb);
write_cb = NULL; write_cb = NULL;
cl->reading_state = MEI_IDLE; cl->reading_state = MEI_IDLE;
cl->read_cb = NULL; cl->read_cb = NULL;
...@@ -778,7 +778,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, ...@@ -778,7 +778,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
unlock_dev: unlock_dev:
mutex_unlock(&dev->device_lock); mutex_unlock(&dev->device_lock);
mei_free_cb_private(write_cb); mei_io_cb_free(write_cb);
return rets; return rets;
} }
......
...@@ -291,8 +291,10 @@ int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *cuuid); ...@@ -291,8 +291,10 @@ int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *cuuid);
int mei_me_cl_by_id(struct mei_device *dev, u8 client_id); 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. * mei_io_list_init - Sets up a queue list.
* *
...@@ -361,7 +363,6 @@ struct mei_cl_cb *find_amthi_read_list_entry(struct mei_device *dev, ...@@ -361,7 +363,6 @@ struct mei_cl_cb *find_amthi_read_list_entry(struct mei_device *dev,
void mei_run_next_iamthif_cmd(struct mei_device *dev); void mei_run_next_iamthif_cmd(struct mei_device *dev);
void mei_free_cb_private(struct mei_cl_cb *priv_cb);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment