diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2012-12-25 12:06:10 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-07 13:31:29 -0500 |
commit | e46f187487a8c28e64417e51ba628746a5397838 (patch) | |
tree | 484cc0102c738d7aae646822baabd71ad715eaf9 /drivers/misc/mei/amthif.c | |
parent | cd51ed649fa4bd55c6a78db52b57260797ed56b4 (diff) |
mei: use structured buffer for the write buffer
We can drop useless castings and use proper types.
We remove the casting in mei_hbm_hdr function
and add new function mei_hbm_stop_request_prepare that
utilize the new structure
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/amthif.c')
-rw-r--r-- | drivers/misc/mei/amthif.c | 25 |
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, | |||
432 | int mei_amthif_irq_write_complete(struct mei_device *dev, s32 *slots, | 432 | int 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 | ||