diff options
-rw-r--r-- | drivers/misc/mei/amthif.c | 9 | ||||
-rw-r--r-- | drivers/misc/mei/client.c | 30 | ||||
-rw-r--r-- | drivers/misc/mei/interrupt.c | 5 |
3 files changed, 34 insertions, 10 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c index 718f3a14c1ca..04fd38567729 100644 --- a/drivers/misc/mei/amthif.c +++ b/drivers/misc/mei/amthif.c | |||
@@ -460,6 +460,15 @@ int mei_amthif_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb, | |||
460 | u32 msg_slots = mei_data2slots(len); | 460 | u32 msg_slots = mei_data2slots(len); |
461 | int rets; | 461 | int rets; |
462 | 462 | ||
463 | rets = mei_cl_flow_ctrl_creds(cl); | ||
464 | if (rets < 0) | ||
465 | return rets; | ||
466 | |||
467 | if (rets == 0) { | ||
468 | cl_dbg(dev, cl, "No flow control credentials: not sending.\n"); | ||
469 | return 0; | ||
470 | } | ||
471 | |||
463 | mei_hdr.host_addr = cl->host_client_id; | 472 | mei_hdr.host_addr = cl->host_client_id; |
464 | mei_hdr.me_addr = cl->me_client_id; | 473 | mei_hdr.me_addr = cl->me_client_id; |
465 | mei_hdr.reserved = 0; | 474 | mei_hdr.reserved = 0; |
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 1a53d961302a..2ab9d1613ffc 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c | |||
@@ -702,12 +702,33 @@ err: | |||
702 | int mei_cl_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb, | 702 | int mei_cl_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb, |
703 | s32 *slots, struct mei_cl_cb *cmpl_list) | 703 | s32 *slots, struct mei_cl_cb *cmpl_list) |
704 | { | 704 | { |
705 | struct mei_device *dev = cl->dev; | 705 | struct mei_device *dev; |
706 | struct mei_msg_data *buf; | ||
706 | struct mei_msg_hdr mei_hdr; | 707 | struct mei_msg_hdr mei_hdr; |
707 | size_t len = cb->request_buffer.size - cb->buf_idx; | 708 | size_t len; |
708 | u32 msg_slots = mei_data2slots(len); | 709 | u32 msg_slots; |
709 | int rets; | 710 | int rets; |
710 | 711 | ||
712 | |||
713 | if (WARN_ON(!cl || !cl->dev)) | ||
714 | return -ENODEV; | ||
715 | |||
716 | dev = cl->dev; | ||
717 | |||
718 | buf = &cb->request_buffer; | ||
719 | |||
720 | rets = mei_cl_flow_ctrl_creds(cl); | ||
721 | if (rets < 0) | ||
722 | return rets; | ||
723 | |||
724 | if (rets == 0) { | ||
725 | cl_dbg(dev, cl, "No flow control credentials: not sending.\n"); | ||
726 | return 0; | ||
727 | } | ||
728 | |||
729 | len = buf->size - cb->buf_idx; | ||
730 | msg_slots = mei_data2slots(len); | ||
731 | |||
711 | mei_hdr.host_addr = cl->host_client_id; | 732 | mei_hdr.host_addr = cl->host_client_id; |
712 | mei_hdr.me_addr = cl->me_client_id; | 733 | mei_hdr.me_addr = cl->me_client_id; |
713 | mei_hdr.reserved = 0; | 734 | mei_hdr.reserved = 0; |
@@ -730,8 +751,7 @@ int mei_cl_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb, | |||
730 | cb->request_buffer.size, cb->buf_idx); | 751 | cb->request_buffer.size, cb->buf_idx); |
731 | 752 | ||
732 | *slots -= msg_slots; | 753 | *slots -= msg_slots; |
733 | rets = mei_write_message(dev, &mei_hdr, | 754 | rets = mei_write_message(dev, &mei_hdr, buf->data + cb->buf_idx); |
734 | cb->request_buffer.data + cb->buf_idx); | ||
735 | if (rets) { | 755 | if (rets) { |
736 | cl->status = rets; | 756 | cl->status = rets; |
737 | list_move_tail(&cb->list, &cmpl_list->list); | 757 | list_move_tail(&cb->list, &cmpl_list->list); |
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c index e4bb9aee40a1..7a95c07e59a6 100644 --- a/drivers/misc/mei/interrupt.c +++ b/drivers/misc/mei/interrupt.c | |||
@@ -513,11 +513,6 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list) | |||
513 | cl = cb->cl; | 513 | cl = cb->cl; |
514 | if (cl == NULL) | 514 | if (cl == NULL) |
515 | continue; | 515 | continue; |
516 | if (mei_cl_flow_ctrl_creds(cl) <= 0) { | ||
517 | cl_dbg(dev, cl, "No flow control credentials, not sending.\n"); | ||
518 | continue; | ||
519 | } | ||
520 | |||
521 | if (cl == &dev->iamthif_cl) | 516 | if (cl == &dev->iamthif_cl) |
522 | ret = mei_amthif_irq_write_complete(cl, cb, | 517 | ret = mei_amthif_irq_write_complete(cl, cb, |
523 | &slots, cmpl_list); | 518 | &slots, cmpl_list); |