Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 336959
b: refs/heads/master
c: ab5c4a5
h: refs/heads/master
i:
  336957: 9e48463
  336955: f91330a
  336951: 6235cfe
  336943: 8408e72
  336927: fa45288
  336895: eeb4229
v: v3
  • Loading branch information
Tomas Winkler authored and Greg Kroah-Hartman committed Nov 1, 2012
1 parent ae929cc commit 7a4ab01
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c7d3df354dcb7477900b29a1200744a8c976c03a
refs/heads/master: ab5c4a56d46f6a41d238aa6546f900407c9be275
39 changes: 36 additions & 3 deletions trunk/drivers/misc/mei/amthif.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,15 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
}

/**
* mei_amthif_write - write amthif data to amthif client
* mei_amthif_send_cmd - send amthif command to the ME
*
* @dev: the device structure
* @cb: mei call back struct
*
* returns 0 on success, <0 on failure.
*
*/
int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb)
static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
{
struct mei_msg_hdr mei_hdr;
int ret;
Expand Down Expand Up @@ -328,6 +329,38 @@ int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb)
return 0;
}

/**
* mei_amthif_write - write amthif data to amthif client
*
* @dev: the device structure
* @cb: mei call back struct
*
* returns 0 on success, <0 on failure.
*
*/
int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb)
{
int ret;

if (!dev || !cb)
return -ENODEV;

ret = mei_io_cb_alloc_resp_buf(cb, dev->iamthif_mtu);
if (ret)
return ret;

cb->major_file_operations = MEI_IOCTL;

if (!list_empty(&dev->amthi_cmd_list.list) ||
dev->iamthif_state != MEI_IAMTHIF_IDLE) {
dev_dbg(&dev->pdev->dev,
"amthif state = %d\n", dev->iamthif_state);
dev_dbg(&dev->pdev->dev, "AMTHIF: add cb to the wait list\n");
list_add_tail(&cb->list, &dev->amthi_cmd_list.list);
return 0;
}
return mei_amthif_send_cmd(dev, cb);
}
/**
* mei_amthif_run_next_cmd
*
Expand Down Expand Up @@ -360,7 +393,7 @@ void mei_amthif_run_next_cmd(struct mei_device *dev)
cl_tmp = (struct mei_cl *)pos->file_private;

if (cl_tmp && cl_tmp == &dev->iamthif_cl) {
status = mei_amthif_write(dev, pos);
status = mei_amthif_send_cmd(dev, pos);
if (status) {
dev_dbg(&dev->pdev->dev,
"amthi write failed status = %d\n",
Expand Down
25 changes: 5 additions & 20 deletions trunk/drivers/misc/mei/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,27 +620,12 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
cl->sm_state |= MEI_WD_STATE_INDEPENDENCE_MSG_SENT;

if (cl == &dev->iamthif_cl) {
rets = mei_io_cb_alloc_resp_buf(write_cb, dev->iamthif_mtu);
if (rets)
goto err;
rets = mei_amthif_write(dev, write_cb);

write_cb->major_file_operations = MEI_IOCTL;

if (!list_empty(&dev->amthi_cmd_list.list) ||
dev->iamthif_state != MEI_IAMTHIF_IDLE) {
dev_dbg(&dev->pdev->dev, "amthi_state = %d\n",
(int) dev->iamthif_state);
dev_dbg(&dev->pdev->dev, "add amthi cb to amthi cmd waiting list\n");
list_add_tail(&write_cb->list, &dev->amthi_cmd_list.list);
} else {
dev_dbg(&dev->pdev->dev, "call amthi write\n");
rets = mei_amthif_write(dev, write_cb);

if (rets) {
dev_err(&dev->pdev->dev, "amthi write failed with status = %d\n",
rets);
goto err;
}
if (rets) {
dev_err(&dev->pdev->dev,
"amthi write failed with status = %d\n", rets);
goto err;
}
mutex_unlock(&dev->device_lock);
return length;
Expand Down

0 comments on commit 7a4ab01

Please sign in to comment.