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: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Tomas Winkler 2012-10-09 16:50:20 +02:00 committed by Greg Kroah-Hartman
parent fb601adb35
commit 601a1efa63
5 changed files with 35 additions and 35 deletions

View file

@ -341,7 +341,7 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
/* 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);
}
}
@ -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_wr_list, cl);
free:
mei_free_cb_private(cb);
mei_io_cb_free(cb);
return rets;
}

View file

@ -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)
{
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))
@ -1368,11 +1368,10 @@ void mei_timer(struct work_struct *work)
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);
}
}
@ -1404,12 +1403,11 @@ void mei_timer(struct work_struct *work)
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);

View file

@ -38,6 +38,21 @@
#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
*
@ -231,7 +246,7 @@ int mei_ioctl_connect_client(struct file *file,
rets = 0;
end:
dev_dbg(&dev->pdev->dev, "free connect cb memory.");
kfree(cb);
mei_io_cb_free(cb);
return rets;
}
@ -375,7 +390,7 @@ int amthi_read(struct mei_device *dev, struct file *file,
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;
}
@ -444,7 +459,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl)
}
return rets;
unlock:
mei_free_cb_private(cb);
mei_io_cb_free(cb);
return rets;
}
@ -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);
}

View file

@ -124,7 +124,7 @@ static bool mei_clear_list(struct mei_device *dev,
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;
}
@ -169,7 +169,7 @@ static bool mei_clear_lists(struct mei_device *dev, struct file *file)
/* 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;
}
@ -332,7 +332,7 @@ static int mei_release(struct inode *inode, struct file *file)
file->private_data = NULL;
if (cb) {
mei_free_cb_private(cb);
mei_io_cb_free(cb);
cb = NULL;
}
@ -504,7 +504,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
/* 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;
@ -651,7 +651,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
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;
}
}
@ -663,7 +663,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
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;
@ -778,7 +778,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
unlock_dev:
mutex_unlock(&dev->device_lock);
mei_free_cb_private(write_cb);
mei_io_cb_free(write_cb);
return rets;
}

View file

@ -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);
/*
* 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.
*
@ -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_free_cb_private(struct mei_cl_cb *priv_cb);
/*