mei: add common prefix to hbm function

1. use mei_hbm_ for basic host bus message function
2. use mei_hbm_cl prefix for host bus messages that operation
on behalf of a client

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-12-25 19:06:11 +02:00 коммит произвёл Greg Kroah-Hartman
Родитель e46f187487
Коммит 8120e7201c
8 изменённых файлов: 53 добавлений и 50 удалений

Просмотреть файл

@ -98,7 +98,7 @@ void mei_amthif_host_init(struct mei_device *dev)
dev->iamthif_msg_buf = msg_buf;
if (mei_connect(dev, &dev->iamthif_cl)) {
if (mei_hbm_cl_connect_req(dev, &dev->iamthif_cl)) {
dev_dbg(&dev->pdev->dev, "Failed to connect to AMTHI client\n");
dev->iamthif_cl.state = MEI_FILE_DISCONNECTED;
dev->iamthif_cl.host_client_id = 0;
@ -558,7 +558,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots)
return -EMSGSIZE;
}
*slots -= mei_data2slots(sizeof(struct hbm_flow_control));
if (mei_send_flow_control(dev, &dev->iamthif_cl)) {
if (mei_hbm_cl_flow_control_req(dev, &dev->iamthif_cl)) {
dev_dbg(&dev->pdev->dev, "iamthif flow control failed\n");
return -EIO;
}
@ -630,7 +630,8 @@ static bool mei_clear_list(struct mei_device *dev,
if (dev->iamthif_current_cb == cb_pos) {
dev->iamthif_current_cb = NULL;
/* send flow control to iamthif client */
mei_send_flow_control(dev, &dev->iamthif_cl);
mei_hbm_cl_flow_control_req(dev,
&dev->iamthif_cl);
}
/* free all allocated buffers */
mei_io_cb_free(cb_pos);

Просмотреть файл

@ -59,13 +59,11 @@ bool mei_hbm_cl_addr_equal(struct mei_cl *cl, void *buf)
/**
* host_start_message - mei host sends start message.
* mei_hbm_start_req - sends start request message.
*
* @dev: the device structure
*
* returns none.
*/
void mei_host_start_message(struct mei_device *dev)
void mei_hbm_start_req(struct mei_device *dev)
{
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
struct hbm_host_version_request *start_req;
@ -92,13 +90,13 @@ void mei_host_start_message(struct mei_device *dev)
}
/**
* host_enum_clients_message - host sends enumeration client request message.
* mei_hbm_enum_clients_req - sends enumeration client request message.
*
* @dev: the device structure
*
* returns none.
*/
void mei_host_enum_clients_message(struct mei_device *dev)
static void mei_hbm_enum_clients_req(struct mei_device *dev)
{
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
struct hbm_host_enum_request *enum_req;
@ -120,8 +118,15 @@ void mei_host_enum_clients_message(struct mei_device *dev)
return;
}
/**
* mei_hbm_prop_requsest - request property for a single client
*
* @dev: the device structure
*
* returns none.
*/
int mei_host_client_enumerate(struct mei_device *dev)
static int mei_hbm_prop_req(struct mei_device *dev)
{
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
@ -191,14 +196,14 @@ static void mei_hbm_stop_req_prepare(struct mei_device *dev,
}
/**
* mei_send_flow_control - sends flow control to fw.
* mei_hbm_cl_flow_control_req - sends flow control requst.
*
* @dev: the device structure
* @cl: private data of the file object
* @cl: client info
*
* This function returns -EIO on write failure
*/
int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl)
int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl)
{
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
const size_t len = sizeof(struct hbm_flow_control);
@ -213,14 +218,14 @@ int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl)
}
/**
* mei_disconnect - sends disconnect message to fw.
* mei_hbm_cl_disconnect_req - sends disconnect message to fw.
*
* @dev: the device structure
* @cl: private data of the file object
* @cl: a client to disconnect from
*
* This function returns -EIO on write failure
*/
int mei_disconnect(struct mei_device *dev, struct mei_cl *cl)
int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl)
{
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
const size_t len = sizeof(struct hbm_client_connect_request);
@ -232,14 +237,14 @@ int mei_disconnect(struct mei_device *dev, struct mei_cl *cl)
}
/**
* mei_connect - sends connect message to fw.
* mei_hbm_cl_connect_req - send connection request to specific me client
*
* @dev: the device structure
* @cl: private data of the file object
* @cl: a client to connect to
*
* This function returns -EIO on write failure
* returns -EIO on write failure
*/
int mei_connect(struct mei_device *dev, struct mei_cl *cl)
int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl)
{
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
const size_t len = sizeof(struct hbm_client_connect_request);
@ -251,12 +256,13 @@ int mei_connect(struct mei_device *dev, struct mei_cl *cl)
}
/**
* mei_client_disconnect_request - disconnects from request irq routine
* mei_client_disconnect_request - disconnect request initiated by me
* host sends disoconnect response
*
* @dev: the device structure.
* @disconnect_req: disconnect request bus message.
* @disconnect_req: disconnect request bus message from the me
*/
static void mei_client_disconnect_request(struct mei_device *dev,
static void mei_hbm_fw_disconnect_req(struct mei_device *dev,
struct hbm_client_connect_request *disconnect_req)
{
struct mei_cl *cl, *next;
@ -327,7 +333,7 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
dev->init_clients_state == MEI_START_MESSAGE) {
dev->init_clients_timer = 0;
mei_host_enum_clients_message(dev);
mei_hbm_enum_clients_req(dev);
} else {
dev->recvd_msg = false;
dev_dbg(&dev->pdev->dev, "reset due to received hbm: host start\n");
@ -390,7 +396,8 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
dev->me_client_index++;
dev->me_client_presentation_num++;
mei_host_client_enumerate(dev);
/* request property for the next client */
mei_hbm_prop_req(dev);
break;
@ -406,7 +413,8 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
dev->init_clients_state =
MEI_CLIENT_PROPERTIES_MESSAGE;
mei_host_client_enumerate(dev);
/* first property reqeust */
mei_hbm_prop_req(dev);
} else {
dev_dbg(&dev->pdev->dev, "reset due to received host enumeration clients response bus message.\n");
mei_reset(dev, 1);
@ -423,7 +431,7 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
case CLIENT_DISCONNECT_REQ_CMD:
/* search for client */
disconnect_req = (struct hbm_client_connect_request *)mei_msg;
mei_client_disconnect_request(dev, disconnect_req);
mei_hbm_fw_disconnect_req(dev, disconnect_req);
break;
case ME_STOP_REQ_CMD:

Просмотреть файл

@ -529,9 +529,9 @@ int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl)
cb->fop_type = MEI_FOP_CLOSE;
if (dev->mei_host_buffer_is_empty) {
dev->mei_host_buffer_is_empty = false;
if (mei_disconnect(dev, cl)) {
if (mei_hbm_cl_disconnect_req(dev, cl)) {
rets = -ENODEV;
dev_dbg(&dev->pdev->dev, "failed to call mei_disconnect.\n");
dev_err(&dev->pdev->dev, "failed to disconnect.\n");
goto free;
}
mdelay(10); /* Wait for hardware disconnection ready */

Просмотреть файл

@ -69,12 +69,15 @@ void mei_watchdog_register(struct mei_device *dev);
*/
void mei_watchdog_unregister(struct mei_device *dev);
int mei_other_client_is_connecting(struct mei_device *dev, struct mei_cl *cl);
int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl);
int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl);
void mei_hbm_start_req(struct mei_device *dev);
int mei_disconnect(struct mei_device *dev, struct mei_cl *cl);
int mei_other_client_is_connecting(struct mei_device *dev, struct mei_cl *cl);
int mei_connect(struct mei_device *dev, struct mei_cl *cl);
int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl);
int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl);
int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl);
void mei_host_client_init(struct work_struct *work);
#endif /* _MEI_INTERFACE_H_ */

Просмотреть файл

@ -157,7 +157,7 @@ static int _mei_irq_thread_close(struct mei_device *dev, s32 *slots,
*slots -= mei_data2slots(sizeof(struct hbm_client_connect_request));
if (mei_disconnect(dev, cl)) {
if (mei_hbm_cl_disconnect_req(dev, cl)) {
cl->status = 0;
cb_pos->buf_idx = 0;
list_move_tail(&cb_pos->list, &cmpl_list->list);
@ -407,7 +407,7 @@ static int _mei_irq_thread_read(struct mei_device *dev, s32 *slots,
*slots -= mei_data2slots(sizeof(struct hbm_flow_control));
if (mei_send_flow_control(dev, cl)) {
if (mei_hbm_cl_flow_control_req(dev, cl)) {
cl->status = -ENODEV;
cb_pos->buf_idx = 0;
list_move_tail(&cb_pos->list, &cmpl_list->list);
@ -443,8 +443,8 @@ static int _mei_irq_thread_ioctl(struct mei_device *dev, s32 *slots,
}
cl->state = MEI_FILE_CONNECTING;
*slots -= mei_data2slots(sizeof(struct hbm_client_connect_request));
if (mei_connect(dev, cl)) {
*slots -= mei_data2slots(sizeof(struct hbm_client_connect_request));
if (mei_hbm_cl_connect_req(dev, cl)) {
cl->status = -ENODEV;
cb_pos->buf_idx = 0;
list_del(&cb_pos->list);
@ -927,7 +927,7 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)
/* link is established
* start sending messages.
*/
mei_host_start_message(dev);
mei_hbm_start_req(dev);
mutex_unlock(&dev->device_lock);
return IRQ_HANDLED;
} else {

Просмотреть файл

@ -258,7 +258,7 @@ int mei_ioctl_connect_client(struct file *file,
&& !mei_other_client_is_connecting(dev, cl)) {
dev_dbg(&dev->pdev->dev, "Sending Connect Message\n");
dev->mei_host_buffer_is_empty = false;
if (mei_connect(dev, cl)) {
if (mei_hbm_cl_connect_req(dev, cl)) {
dev_dbg(&dev->pdev->dev, "Sending connect message - failed\n");
rets = -ENODEV;
goto end;
@ -350,7 +350,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl)
cl->read_cb = cb;
if (dev->mei_host_buffer_is_empty) {
dev->mei_host_buffer_is_empty = false;
if (mei_send_flow_control(dev, cl)) {
if (mei_hbm_cl_flow_control_req(dev, cl)) {
rets = -ENODEV;
goto err;
}

Просмотреть файл

@ -383,15 +383,6 @@ static inline bool mei_cl_cmp_id(const struct mei_cl *cl1,
}
/*
* MEI Host Client Functions
*/
void mei_host_start_message(struct mei_device *dev);
void mei_host_enum_clients_message(struct mei_device *dev);
int mei_host_client_enumerate(struct mei_device *dev);
void mei_host_client_init(struct work_struct *work);
/*
* MEI interrupt functions prototype
*/

Просмотреть файл

@ -79,7 +79,7 @@ int mei_wd_host_init(struct mei_device *dev)
return -ENOENT;
}
if (mei_connect(dev, &dev->wd_cl)) {
if (mei_hbm_cl_connect_req(dev, &dev->wd_cl)) {
dev_err(&dev->pdev->dev, "wd: failed to connect to the client\n");
dev->wd_cl.state = MEI_FILE_DISCONNECTED;
dev->wd_cl.host_client_id = 0;