aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/amthif.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/mei/amthif.c')
-rw-r--r--drivers/misc/mei/amthif.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index bb613f733309..f9d458cced21 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -432,34 +432,33 @@ unsigned int mei_amthif_poll(struct mei_device *dev,
432int mei_amthif_irq_write_complete(struct mei_device *dev, s32 *slots, 432int mei_amthif_irq_write_complete(struct mei_device *dev, s32 *slots,
433 struct mei_cl_cb *cb, struct mei_cl_cb *cmpl_list) 433 struct mei_cl_cb *cb, struct mei_cl_cb *cmpl_list)
434{ 434{
435 struct mei_msg_hdr *mei_hdr; 435 struct mei_msg_hdr mei_hdr;
436 struct mei_cl *cl = cb->cl; 436 struct mei_cl *cl = cb->cl;
437 size_t len = dev->iamthif_msg_buf_size - dev->iamthif_msg_buf_index; 437 size_t len = dev->iamthif_msg_buf_size - dev->iamthif_msg_buf_index;
438 size_t msg_slots = mei_data2slots(len); 438 size_t msg_slots = mei_data2slots(len);
439 439
440 mei_hdr = (struct mei_msg_hdr *)&dev->wr_msg_buf[0]; 440 mei_hdr.host_addr = cl->host_client_id;
441 mei_hdr->host_addr = cl->host_client_id; 441 mei_hdr.me_addr = cl->me_client_id;
442 mei_hdr->me_addr = cl->me_client_id; 442 mei_hdr.reserved = 0;
443 mei_hdr->reserved = 0;
444 443
445 if (*slots >= msg_slots) { 444 if (*slots >= msg_slots) {
446 mei_hdr->length = len; 445 mei_hdr.length = len;
447 mei_hdr->msg_complete = 1; 446 mei_hdr.msg_complete = 1;
448 /* Split the message only if we can write the whole host buffer */ 447 /* Split the message only if we can write the whole host buffer */
449 } else if (*slots == dev->hbuf_depth) { 448 } else if (*slots == dev->hbuf_depth) {
450 msg_slots = *slots; 449 msg_slots = *slots;
451 len = (*slots * sizeof(u32)) - sizeof(struct mei_msg_hdr); 450 len = (*slots * sizeof(u32)) - sizeof(struct mei_msg_hdr);
452 mei_hdr->length = len; 451 mei_hdr.length = len;
453 mei_hdr->msg_complete = 0; 452 mei_hdr.msg_complete = 0;
454 } else { 453 } else {
455 /* wait for next time the host buffer is empty */ 454 /* wait for next time the host buffer is empty */
456 return 0; 455 return 0;
457 } 456 }
458 457
459 dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(mei_hdr)); 458 dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(&mei_hdr));
460 459
461 *slots -= msg_slots; 460 *slots -= msg_slots;
462 if (mei_write_message(dev, mei_hdr, 461 if (mei_write_message(dev, &mei_hdr,
463 dev->iamthif_msg_buf + dev->iamthif_msg_buf_index)) { 462 dev->iamthif_msg_buf + dev->iamthif_msg_buf_index)) {
464 dev->iamthif_state = MEI_IAMTHIF_IDLE; 463 dev->iamthif_state = MEI_IAMTHIF_IDLE;
465 cl->status = -ENODEV; 464 cl->status = -ENODEV;
@@ -470,10 +469,10 @@ int mei_amthif_irq_write_complete(struct mei_device *dev, s32 *slots,
470 if (mei_flow_ctrl_reduce(dev, cl)) 469 if (mei_flow_ctrl_reduce(dev, cl))
471 return -ENODEV; 470 return -ENODEV;
472 471
473 dev->iamthif_msg_buf_index += mei_hdr->length; 472 dev->iamthif_msg_buf_index += mei_hdr.length;
474 cl->status = 0; 473 cl->status = 0;
475 474
476 if (mei_hdr->msg_complete) { 475 if (mei_hdr.msg_complete) {
477 dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL; 476 dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL;
478 dev->iamthif_flow_control_pending = true; 477 dev->iamthif_flow_control_pending = true;
479 478