diff options
Diffstat (limited to 'drivers/misc/mei/init.c')
-rw-r--r-- | drivers/misc/mei/init.c | 67 |
1 files changed, 32 insertions, 35 deletions
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index 85b6520f39f1..4fcb0bb2c9f0 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c | |||
@@ -281,12 +281,10 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) | |||
281 | cl_pos->timer_count = 0; | 281 | cl_pos->timer_count = 0; |
282 | } | 282 | } |
283 | /* remove entry if already in list */ | 283 | /* remove entry if already in list */ |
284 | dev_dbg(&dev->pdev->dev, "list del iamthif and wd file list.\n"); | 284 | dev_dbg(&dev->pdev->dev, "remove iamthif and wd from the file list.\n"); |
285 | mei_remove_client_from_file_list(dev, | 285 | mei_me_cl_unlink(dev, &dev->wd_cl); |
286 | dev->wd_cl.host_client_id); | ||
287 | 286 | ||
288 | mei_remove_client_from_file_list(dev, | 287 | mei_me_cl_unlink(dev, &dev->iamthif_cl); |
289 | dev->iamthif_cl.host_client_id); | ||
290 | 288 | ||
291 | mei_amthif_reset_params(dev); | 289 | mei_amthif_reset_params(dev); |
292 | dev->extra_write_index = 0; | 290 | dev->extra_write_index = 0; |
@@ -520,17 +518,20 @@ int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *cuuid) | |||
520 | 518 | ||
521 | 519 | ||
522 | /** | 520 | /** |
523 | * mei_me_cl_update_filext - searches for ME client guid | 521 | * mei_me_cl_link - create link between host and me clinet and add |
524 | * sets client_id in mei_file_private if found | 522 | * me_cl to the list |
523 | * | ||
525 | * @dev: the device structure | 524 | * @dev: the device structure |
526 | * @cl: private file structure to set client_id in | 525 | * @cl: link between me and host client assocated with opened file descriptor |
527 | * @cuuid: searched uuid of ME client | 526 | * @cuuid: uuid of ME client |
528 | * @client_id: id of host client to be set in file private structure | 527 | * @client_id: id of the host client |
529 | * | 528 | * |
530 | * returns ME client index | 529 | * returns ME client index if ME client |
530 | * -EINVAL on incorrect values | ||
531 | * -ENONET if client not found | ||
531 | */ | 532 | */ |
532 | int mei_me_cl_update_filext(struct mei_device *dev, struct mei_cl *cl, | 533 | int mei_me_cl_link(struct mei_device *dev, struct mei_cl *cl, |
533 | const uuid_le *cuuid, u8 host_cl_id) | 534 | const uuid_le *cuuid, u8 host_cl_id) |
534 | { | 535 | { |
535 | int i; | 536 | int i; |
536 | 537 | ||
@@ -550,6 +551,24 @@ int mei_me_cl_update_filext(struct mei_device *dev, struct mei_cl *cl, | |||
550 | 551 | ||
551 | return -ENOENT; | 552 | return -ENOENT; |
552 | } | 553 | } |
554 | /** | ||
555 | * mei_me_cl_unlink - remove me_cl from the list | ||
556 | * | ||
557 | * @dev: the device structure | ||
558 | * @host_client_id: host client id to be removed | ||
559 | */ | ||
560 | void mei_me_cl_unlink(struct mei_device *dev, struct mei_cl *cl) | ||
561 | { | ||
562 | struct mei_cl *pos, *next; | ||
563 | list_for_each_entry_safe(pos, next, &dev->file_list, link) { | ||
564 | if (cl->host_client_id == pos->host_client_id) { | ||
565 | dev_dbg(&dev->pdev->dev, "remove host client = %d, ME client = %d\n", | ||
566 | pos->host_client_id, pos->me_client_id); | ||
567 | list_del_init(&pos->link); | ||
568 | break; | ||
569 | } | ||
570 | } | ||
571 | } | ||
553 | 572 | ||
554 | /** | 573 | /** |
555 | * mei_alloc_file_private - allocates a private file structure and sets it up. | 574 | * mei_alloc_file_private - allocates a private file structure and sets it up. |
@@ -642,25 +661,3 @@ free: | |||
642 | return rets; | 661 | return rets; |
643 | } | 662 | } |
644 | 663 | ||
645 | /** | ||
646 | * mei_remove_client_from_file_list - | ||
647 | * removes file private data from device file list | ||
648 | * | ||
649 | * @dev: the device structure | ||
650 | * @host_client_id: host client id to be removed | ||
651 | */ | ||
652 | void mei_remove_client_from_file_list(struct mei_device *dev, | ||
653 | u8 host_client_id) | ||
654 | { | ||
655 | struct mei_cl *cl_pos = NULL; | ||
656 | struct mei_cl *cl_next = NULL; | ||
657 | list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) { | ||
658 | if (host_client_id == cl_pos->host_client_id) { | ||
659 | dev_dbg(&dev->pdev->dev, "remove host client = %d, ME client = %d\n", | ||
660 | cl_pos->host_client_id, | ||
661 | cl_pos->me_client_id); | ||
662 | list_del_init(&cl_pos->link); | ||
663 | break; | ||
664 | } | ||
665 | } | ||
666 | } | ||