diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2012-11-01 15:17:18 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-01 15:31:19 -0400 |
commit | ab5c4a56d46f6a41d238aa6546f900407c9be275 (patch) | |
tree | f4150a5cc01bc2af12c01d6043b43b0b89214105 /drivers/misc/mei/amthif.c | |
parent | c7d3df354dcb7477900b29a1200744a8c976c03a (diff) |
mei: move amthif specific code from mei_write to mei_amthif_write
For sake of amthif consolidation move amthif specific code from
mei_write to mei_amthif_write
The original mei_amthif_write to mei_amthif_send_cmd
as this function deals with sending single command
while mei_amthif_write is interface function called from
the main driver which in turns calls mei_amthif_send_cmd
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 | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c index 392203d8d254..96db3ad21259 100644 --- a/drivers/misc/mei/amthif.c +++ b/drivers/misc/mei/amthif.c | |||
@@ -255,14 +255,15 @@ out: | |||
255 | } | 255 | } |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * mei_amthif_write - write amthif data to amthif client | 258 | * mei_amthif_send_cmd - send amthif command to the ME |
259 | * | 259 | * |
260 | * @dev: the device structure | 260 | * @dev: the device structure |
261 | * @cb: mei call back struct | 261 | * @cb: mei call back struct |
262 | * | 262 | * |
263 | * returns 0 on success, <0 on failure. | 263 | * returns 0 on success, <0 on failure. |
264 | * | ||
264 | */ | 265 | */ |
265 | int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb) | 266 | static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb) |
266 | { | 267 | { |
267 | struct mei_msg_hdr mei_hdr; | 268 | struct mei_msg_hdr mei_hdr; |
268 | int ret; | 269 | int ret; |
@@ -329,6 +330,38 @@ int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb) | |||
329 | } | 330 | } |
330 | 331 | ||
331 | /** | 332 | /** |
333 | * mei_amthif_write - write amthif data to amthif client | ||
334 | * | ||
335 | * @dev: the device structure | ||
336 | * @cb: mei call back struct | ||
337 | * | ||
338 | * returns 0 on success, <0 on failure. | ||
339 | * | ||
340 | */ | ||
341 | int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb) | ||
342 | { | ||
343 | int ret; | ||
344 | |||
345 | if (!dev || !cb) | ||
346 | return -ENODEV; | ||
347 | |||
348 | ret = mei_io_cb_alloc_resp_buf(cb, dev->iamthif_mtu); | ||
349 | if (ret) | ||
350 | return ret; | ||
351 | |||
352 | cb->major_file_operations = MEI_IOCTL; | ||
353 | |||
354 | if (!list_empty(&dev->amthi_cmd_list.list) || | ||
355 | dev->iamthif_state != MEI_IAMTHIF_IDLE) { | ||
356 | dev_dbg(&dev->pdev->dev, | ||
357 | "amthif state = %d\n", dev->iamthif_state); | ||
358 | dev_dbg(&dev->pdev->dev, "AMTHIF: add cb to the wait list\n"); | ||
359 | list_add_tail(&cb->list, &dev->amthi_cmd_list.list); | ||
360 | return 0; | ||
361 | } | ||
362 | return mei_amthif_send_cmd(dev, cb); | ||
363 | } | ||
364 | /** | ||
332 | * mei_amthif_run_next_cmd | 365 | * mei_amthif_run_next_cmd |
333 | * | 366 | * |
334 | * @dev: the device structure | 367 | * @dev: the device structure |
@@ -360,7 +393,7 @@ void mei_amthif_run_next_cmd(struct mei_device *dev) | |||
360 | cl_tmp = (struct mei_cl *)pos->file_private; | 393 | cl_tmp = (struct mei_cl *)pos->file_private; |
361 | 394 | ||
362 | if (cl_tmp && cl_tmp == &dev->iamthif_cl) { | 395 | if (cl_tmp && cl_tmp == &dev->iamthif_cl) { |
363 | status = mei_amthif_write(dev, pos); | 396 | status = mei_amthif_send_cmd(dev, pos); |
364 | if (status) { | 397 | if (status) { |
365 | dev_dbg(&dev->pdev->dev, | 398 | dev_dbg(&dev->pdev->dev, |
366 | "amthi write failed status = %d\n", | 399 | "amthi write failed status = %d\n", |