Commit 68d1aa65 authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

mei: use wrapper for simple hbm client message

Reduce few code lines by using wrappers for sending
simple hbm client messages
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3438c1f3
......@@ -124,7 +124,7 @@ static int mei_hbm_me_cl_allocate(struct mei_device *dev)
/**
* mei_hbm_cl_hdr - construct client hbm header
*
* @cl: - client
* @cl: client
* @hbm_cmd: host bus message command
* @buf: buffer for cl header
* @len: buffer length
......@@ -141,6 +141,26 @@ void mei_hbm_cl_hdr(struct mei_cl *cl, u8 hbm_cmd, void *buf, size_t len)
cmd->me_addr = cl->me_client_id;
}
/**
* mei_hbm_cl_write - write simple hbm client message
*
* @dev: the device structure
* @cl: client
* @hbm_cmd: host bus message command
* @len: buffer length
*/
static inline
int mei_hbm_cl_write(struct mei_device *dev,
struct mei_cl *cl, u8 hbm_cmd, size_t len)
{
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
mei_hbm_hdr(mei_hdr, len);
mei_hbm_cl_hdr(cl, hbm_cmd, dev->wr_msg.data, len);
return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
}
/**
* mei_hbm_cl_addr_equal - tells if they have the same address
*
......@@ -365,15 +385,9 @@ static int mei_hbm_stop_req(struct mei_device *dev)
*/
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);
mei_hbm_hdr(mei_hdr, len);
mei_hbm_cl_hdr(cl, MEI_FLOW_CONTROL_CMD, dev->wr_msg.data, len);
cl_dbg(dev, cl, "sending flow control\n");
return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
return mei_hbm_cl_write(dev, cl, MEI_FLOW_CONTROL_CMD, len);
}
/**
......@@ -452,13 +466,8 @@ static void mei_hbm_cl_flow_control_res(struct mei_device *dev,
*/
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);
mei_hbm_hdr(mei_hdr, len);
mei_hbm_cl_hdr(cl, CLIENT_DISCONNECT_REQ_CMD, dev->wr_msg.data, len);
return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
return mei_hbm_cl_write(dev, cl, CLIENT_DISCONNECT_REQ_CMD, len);
}
/**
......@@ -471,13 +480,8 @@ int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl)
*/
int mei_hbm_cl_disconnect_rsp(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_response);
mei_hbm_hdr(mei_hdr, len);
mei_hbm_cl_hdr(cl, CLIENT_DISCONNECT_RES_CMD, dev->wr_msg.data, len);
return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
return mei_hbm_cl_write(dev, cl, CLIENT_DISCONNECT_RES_CMD, len);
}
/**
......@@ -526,13 +530,8 @@ static void mei_hbm_cl_disconnect_res(struct mei_device *dev,
*/
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);
mei_hbm_hdr(mei_hdr, len);
mei_hbm_cl_hdr(cl, CLIENT_CONNECT_REQ_CMD, dev->wr_msg.data, len);
return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
return mei_hbm_cl_write(dev, cl, CLIENT_CONNECT_REQ_CMD, len);
}
/**
......
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