diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2012-10-11 10:35:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-24 18:37:31 -0400 |
commit | 664df38b3c74656261d4227b4dd380cfa453f78f (patch) | |
tree | 35d05f657d0cd04d562edea962bc9122179caf64 /drivers/misc/mei/main.c | |
parent | 601a1efa630aab0ca72bf8d638c441a09654b250 (diff) |
mei: use mei_io_cb_ warppers also for control flows
move the mei_io_cb_ wrappers to to iorw.c for global use
and use them also for handling control flows
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/main.c')
-rw-r--r-- | drivers/misc/mei/main.c | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 518e07eb1075..ed4943f6b6c2 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -513,84 +513,6 @@ out: | |||
513 | mutex_unlock(&dev->device_lock); | 513 | mutex_unlock(&dev->device_lock); |
514 | return rets; | 514 | return rets; |
515 | } | 515 | } |
516 | |||
517 | /** | ||
518 | * mei_io_cb_init - allocate and initialize io callback | ||
519 | * | ||
520 | * @cl - mei client | ||
521 | * @file: pointer to file structure | ||
522 | * | ||
523 | * returns mei_cl_cb pointer or NULL; | ||
524 | */ | ||
525 | static struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, struct file *fp) | ||
526 | { | ||
527 | struct mei_cl_cb *cb; | ||
528 | struct mei_device *dev; | ||
529 | |||
530 | dev = cl->dev; | ||
531 | |||
532 | cb = kzalloc(sizeof(struct mei_cl_cb), GFP_KERNEL); | ||
533 | if (!cb) | ||
534 | return NULL; | ||
535 | |||
536 | mei_io_list_init(cb); | ||
537 | |||
538 | cb->file_object = fp; | ||
539 | cb->file_private = cl; | ||
540 | cb->buf_idx = 0; | ||
541 | return cb; | ||
542 | } | ||
543 | |||
544 | |||
545 | /** | ||
546 | * mei_io_cb_alloc_req_buf - allocate request buffer | ||
547 | * | ||
548 | * @cb - io callback structure | ||
549 | * @size: size of the buffer | ||
550 | * | ||
551 | * returns 0 on success | ||
552 | * -EINVAL if cb is NULL | ||
553 | * -ENOMEM if allocation failed | ||
554 | */ | ||
555 | static int mei_io_cb_alloc_req_buf(struct mei_cl_cb *cb, size_t length) | ||
556 | { | ||
557 | if (!cb) | ||
558 | return -EINVAL; | ||
559 | |||
560 | if (length == 0) | ||
561 | return 0; | ||
562 | |||
563 | cb->request_buffer.data = kmalloc(length, GFP_KERNEL); | ||
564 | if (!cb->request_buffer.data) | ||
565 | return -ENOMEM; | ||
566 | cb->request_buffer.size = length; | ||
567 | return 0; | ||
568 | } | ||
569 | /** | ||
570 | * mei_io_cb_alloc_req_buf - allocate respose buffer | ||
571 | * | ||
572 | * @cb - io callback structure | ||
573 | * @size: size of the buffer | ||
574 | * | ||
575 | * returns 0 on success | ||
576 | * -EINVAL if cb is NULL | ||
577 | * -ENOMEM if allocation failed | ||
578 | */ | ||
579 | static int mei_io_cb_alloc_resp_buf(struct mei_cl_cb *cb, size_t length) | ||
580 | { | ||
581 | if (!cb) | ||
582 | return -EINVAL; | ||
583 | |||
584 | if (length == 0) | ||
585 | return 0; | ||
586 | |||
587 | cb->response_buffer.data = kmalloc(length, GFP_KERNEL); | ||
588 | if (!cb->response_buffer.data) | ||
589 | return -ENOMEM; | ||
590 | cb->response_buffer.size = length; | ||
591 | return 0; | ||
592 | } | ||
593 | |||
594 | /** | 516 | /** |
595 | * mei_write - the write function. | 517 | * mei_write - the write function. |
596 | * | 518 | * |