mirror of https://gitee.com/openkylin/linux.git
mei: propagate error from write routines instead of ENODEV
ENODEV will cause application to try to reconnect since it assumes that device went through the reset write errors are not always fatal it can happen due to resource contention Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
0da9074735
commit
2ebf8c94d4
|
@ -312,13 +312,13 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
|
|||
mei_hdr.me_addr = dev->iamthif_cl.me_client_id;
|
||||
mei_hdr.reserved = 0;
|
||||
dev->iamthif_msg_buf_index += mei_hdr.length;
|
||||
if (mei_write_message(dev, &mei_hdr,
|
||||
(unsigned char *)dev->iamthif_msg_buf))
|
||||
return -ENODEV;
|
||||
ret = mei_write_message(dev, &mei_hdr, dev->iamthif_msg_buf);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (mei_hdr.msg_complete) {
|
||||
if (mei_cl_flow_ctrl_reduce(&dev->iamthif_cl))
|
||||
return -ENODEV;
|
||||
return -EIO;
|
||||
dev->iamthif_flow_control_pending = true;
|
||||
dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL;
|
||||
dev_dbg(&dev->pdev->dev, "add amthif cb to write waiting list\n");
|
||||
|
@ -458,6 +458,7 @@ int mei_amthif_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb,
|
|||
struct mei_msg_hdr mei_hdr;
|
||||
size_t len = dev->iamthif_msg_buf_size - dev->iamthif_msg_buf_index;
|
||||
u32 msg_slots = mei_data2slots(len);
|
||||
int rets;
|
||||
|
||||
mei_hdr.host_addr = cl->host_client_id;
|
||||
mei_hdr.me_addr = cl->me_client_id;
|
||||
|
@ -480,16 +481,17 @@ int mei_amthif_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb,
|
|||
dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(&mei_hdr));
|
||||
|
||||
*slots -= msg_slots;
|
||||
if (mei_write_message(dev, &mei_hdr,
|
||||
dev->iamthif_msg_buf + dev->iamthif_msg_buf_index)) {
|
||||
dev->iamthif_state = MEI_IAMTHIF_IDLE;
|
||||
cl->status = -ENODEV;
|
||||
list_del(&cb->list);
|
||||
return -ENODEV;
|
||||
rets = mei_write_message(dev, &mei_hdr,
|
||||
dev->iamthif_msg_buf + dev->iamthif_msg_buf_index);
|
||||
if (rets) {
|
||||
dev->iamthif_state = MEI_IAMTHIF_IDLE;
|
||||
cl->status = rets;
|
||||
list_del(&cb->list);
|
||||
return rets;
|
||||
}
|
||||
|
||||
if (mei_cl_flow_ctrl_reduce(cl))
|
||||
return -ENODEV;
|
||||
return -EIO;
|
||||
|
||||
dev->iamthif_msg_buf_index += mei_hdr.length;
|
||||
cl->status = 0;
|
||||
|
|
|
@ -706,6 +706,7 @@ int mei_cl_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb,
|
|||
struct mei_msg_hdr mei_hdr;
|
||||
size_t len = cb->request_buffer.size - cb->buf_idx;
|
||||
u32 msg_slots = mei_data2slots(len);
|
||||
int rets;
|
||||
|
||||
mei_hdr.host_addr = cl->host_client_id;
|
||||
mei_hdr.me_addr = cl->me_client_id;
|
||||
|
@ -729,11 +730,12 @@ int mei_cl_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb,
|
|||
cb->request_buffer.size, cb->buf_idx);
|
||||
|
||||
*slots -= msg_slots;
|
||||
if (mei_write_message(dev, &mei_hdr,
|
||||
cb->request_buffer.data + cb->buf_idx)) {
|
||||
cl->status = -ENODEV;
|
||||
rets = mei_write_message(dev, &mei_hdr,
|
||||
cb->request_buffer.data + cb->buf_idx);
|
||||
if (rets) {
|
||||
cl->status = rets;
|
||||
list_move_tail(&cb->list, &cmpl_list->list);
|
||||
return -ENODEV;
|
||||
return rets;
|
||||
}
|
||||
|
||||
cl->status = 0;
|
||||
|
@ -742,7 +744,7 @@ int mei_cl_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb,
|
|||
|
||||
if (mei_hdr.msg_complete) {
|
||||
if (mei_cl_flow_ctrl_reduce(cl))
|
||||
return -ENODEV;
|
||||
return -EIO;
|
||||
list_move_tail(&cb->list, &dev->write_waiting_list.list);
|
||||
}
|
||||
|
||||
|
@ -811,10 +813,9 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
|
|||
mei_hdr.reserved = 0;
|
||||
|
||||
|
||||
if (mei_write_message(dev, &mei_hdr, buf->data)) {
|
||||
rets = -EIO;
|
||||
rets = mei_write_message(dev, &mei_hdr, buf->data);
|
||||
if (rets)
|
||||
goto err;
|
||||
}
|
||||
|
||||
cl->writing_state = MEI_WRITING;
|
||||
cb->buf_idx = mei_hdr.length;
|
||||
|
|
|
@ -170,7 +170,7 @@ int mei_hbm_start_req(struct mei_device *dev)
|
|||
dev_err(&dev->pdev->dev, "version message write failed\n");
|
||||
dev->dev_state = MEI_DEV_RESETTING;
|
||||
mei_reset(dev, 1);
|
||||
return -ENODEV;
|
||||
return -EIO;
|
||||
}
|
||||
dev->hbm_state = MEI_HBM_START;
|
||||
dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT;
|
||||
|
|
|
@ -216,9 +216,11 @@ static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb,
|
|||
s32 *slots, struct mei_cl_cb *cmpl_list)
|
||||
{
|
||||
struct mei_device *dev = cl->dev;
|
||||
|
||||
u32 msg_slots = mei_data2slots(sizeof(struct hbm_flow_control));
|
||||
|
||||
int ret;
|
||||
|
||||
|
||||
if (*slots < msg_slots) {
|
||||
/* return the cancel routine */
|
||||
list_del(&cb->list);
|
||||
|
@ -227,12 +229,14 @@ static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb,
|
|||
|
||||
*slots -= msg_slots;
|
||||
|
||||
if (mei_hbm_cl_flow_control_req(dev, cl)) {
|
||||
cl->status = -ENODEV;
|
||||
ret = mei_hbm_cl_flow_control_req(dev, cl);
|
||||
if (ret) {
|
||||
cl->status = ret;
|
||||
cb->buf_idx = 0;
|
||||
list_move_tail(&cb->list, &cmpl_list->list);
|
||||
return -ENODEV;
|
||||
return ret;
|
||||
}
|
||||
|
||||
list_move_tail(&cb->list, &dev->read_list.list);
|
||||
|
||||
return 0;
|
||||
|
@ -254,6 +258,7 @@ static int mei_cl_irq_ioctl(struct mei_cl *cl, struct mei_cl_cb *cb,
|
|||
s32 *slots, struct mei_cl_cb *cmpl_list)
|
||||
{
|
||||
struct mei_device *dev = cl->dev;
|
||||
int ret;
|
||||
|
||||
u32 msg_slots =
|
||||
mei_data2slots(sizeof(struct hbm_client_connect_request));
|
||||
|
@ -268,11 +273,12 @@ static int mei_cl_irq_ioctl(struct mei_cl *cl, struct mei_cl_cb *cb,
|
|||
|
||||
cl->state = MEI_FILE_CONNECTING;
|
||||
|
||||
if (mei_hbm_cl_connect_req(dev, cl)) {
|
||||
cl->status = -ENODEV;
|
||||
ret = mei_hbm_cl_connect_req(dev, cl);
|
||||
if (ret) {
|
||||
cl->status = ret;
|
||||
cb->buf_idx = 0;
|
||||
list_del(&cb->list);
|
||||
return -ENODEV;
|
||||
return ret;
|
||||
}
|
||||
|
||||
list_move_tail(&cb->list, &dev->ctrl_rd_list.list);
|
||||
|
|
Loading…
Reference in New Issue