diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2012-11-11 10:38:03 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-15 18:34:19 -0500 |
commit | ff8b2f4e424a489222d3c7d55fb2d04c9639ef98 (patch) | |
tree | 856e8e9881145ae6a8ce4a71ae4344928f22f69f /drivers/misc | |
parent | 744f0f2f424d374b233cea5f9b34caa851543755 (diff) |
mei: use link and unlink terms for connecting ME and HOST client
1. rename mei_me_cl_update_filext to mei_me_cl_link
2. rename mei_remove_client_from_file_list to mei_me_cl_unlink
Code style, documenation, and usage of both function is updated
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/mei/amthif.c | 4 | ||||
-rw-r--r-- | drivers/misc/mei/init.c | 67 | ||||
-rw-r--r-- | drivers/misc/mei/iorw.c | 16 | ||||
-rw-r--r-- | drivers/misc/mei/main.c | 6 | ||||
-rw-r--r-- | drivers/misc/mei/mei_dev.h | 4 | ||||
-rw-r--r-- | drivers/misc/mei/wd.c | 8 |
6 files changed, 44 insertions, 61 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c index 7416241dce88..095d0595a49e 100644 --- a/drivers/misc/mei/amthif.c +++ b/drivers/misc/mei/amthif.c | |||
@@ -73,10 +73,10 @@ void mei_amthif_host_init(struct mei_device *dev) | |||
73 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTED; | 73 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTED; |
74 | 74 | ||
75 | /* find ME amthi client */ | 75 | /* find ME amthi client */ |
76 | i = mei_me_cl_update_filext(dev, &dev->iamthif_cl, | 76 | i = mei_me_cl_link(dev, &dev->iamthif_cl, |
77 | &mei_amthi_guid, MEI_IAMTHIF_HOST_CLIENT_ID); | 77 | &mei_amthi_guid, MEI_IAMTHIF_HOST_CLIENT_ID); |
78 | if (i < 0) { | 78 | if (i < 0) { |
79 | dev_dbg(&dev->pdev->dev, "failed to find iamthif client.\n"); | 79 | dev_info(&dev->pdev->dev, "failed to find iamthif client.\n"); |
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | 82 | ||
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 | } | ||
diff --git a/drivers/misc/mei/iorw.c b/drivers/misc/mei/iorw.c index cf1107658bc0..eb93a1b53b9b 100644 --- a/drivers/misc/mei/iorw.c +++ b/drivers/misc/mei/iorw.c | |||
@@ -171,8 +171,6 @@ int mei_ioctl_connect_client(struct file *file, | |||
171 | struct mei_cl_cb *cb; | 171 | struct mei_cl_cb *cb; |
172 | struct mei_client *client; | 172 | struct mei_client *client; |
173 | struct mei_cl *cl; | 173 | struct mei_cl *cl; |
174 | struct mei_cl *cl_pos = NULL; | ||
175 | struct mei_cl *cl_next = NULL; | ||
176 | long timeout = mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT); | 174 | long timeout = mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT); |
177 | int i; | 175 | int i; |
178 | int err; | 176 | int err; |
@@ -229,21 +227,9 @@ int mei_ioctl_connect_client(struct file *file, | |||
229 | goto end; | 227 | goto end; |
230 | } | 228 | } |
231 | clear_bit(cl->host_client_id, dev->host_clients_map); | 229 | clear_bit(cl->host_client_id, dev->host_clients_map); |
232 | list_for_each_entry_safe(cl_pos, cl_next, | 230 | mei_me_cl_unlink(dev, cl); |
233 | &dev->file_list, link) { | ||
234 | if (mei_cl_cmp_id(cl, cl_pos)) { | ||
235 | dev_dbg(&dev->pdev->dev, | ||
236 | "remove file private data node host" | ||
237 | " client = %d, ME client = %d.\n", | ||
238 | cl_pos->host_client_id, | ||
239 | cl_pos->me_client_id); | ||
240 | list_del(&cl_pos->link); | ||
241 | } | ||
242 | 231 | ||
243 | } | ||
244 | dev_dbg(&dev->pdev->dev, "free file private data memory.\n"); | ||
245 | kfree(cl); | 232 | kfree(cl); |
246 | |||
247 | cl = NULL; | 233 | cl = NULL; |
248 | file->private_data = &dev->iamthif_cl; | 234 | file->private_data = &dev->iamthif_cl; |
249 | 235 | ||
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 2cc1ebb131ba..251aafff5492 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -227,7 +227,7 @@ static int mei_release(struct inode *inode, struct file *file) | |||
227 | clear_bit(cl->host_client_id, dev->host_clients_map); | 227 | clear_bit(cl->host_client_id, dev->host_clients_map); |
228 | dev->open_handle_count--; | 228 | dev->open_handle_count--; |
229 | } | 229 | } |
230 | mei_remove_client_from_file_list(dev, cl->host_client_id); | 230 | mei_me_cl_unlink(dev, cl); |
231 | 231 | ||
232 | /* free read cb */ | 232 | /* free read cb */ |
233 | cb = NULL; | 233 | cb = NULL; |
@@ -913,8 +913,8 @@ static void __devexit mei_remove(struct pci_dev *pdev) | |||
913 | 913 | ||
914 | /* remove entry if already in list */ | 914 | /* remove entry if already in list */ |
915 | dev_dbg(&pdev->dev, "list del iamthif and wd file list.\n"); | 915 | dev_dbg(&pdev->dev, "list del iamthif and wd file list.\n"); |
916 | mei_remove_client_from_file_list(dev, dev->wd_cl.host_client_id); | 916 | mei_me_cl_unlink(dev, &dev->wd_cl); |
917 | mei_remove_client_from_file_list(dev, dev->iamthif_cl.host_client_id); | 917 | mei_me_cl_unlink(dev, &dev->iamthif_cl); |
918 | 918 | ||
919 | dev->iamthif_current_cb = NULL; | 919 | dev->iamthif_current_cb = NULL; |
920 | dev->me_clients_num = 0; | 920 | dev->me_clients_num = 0; |
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index dad85f3fe390..aaee666577b4 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
@@ -301,12 +301,12 @@ int mei_hw_init(struct mei_device *dev); | |||
301 | int mei_task_initialize_clients(void *data); | 301 | int mei_task_initialize_clients(void *data); |
302 | int mei_initialize_clients(struct mei_device *dev); | 302 | int mei_initialize_clients(struct mei_device *dev); |
303 | int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl); | 303 | int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl); |
304 | void mei_remove_client_from_file_list(struct mei_device *dev, u8 host_client_id); | ||
305 | void mei_allocate_me_clients_storage(struct mei_device *dev); | 304 | void mei_allocate_me_clients_storage(struct mei_device *dev); |
306 | 305 | ||
307 | 306 | ||
308 | int mei_me_cl_update_filext(struct mei_device *dev, struct mei_cl *cl, | 307 | int mei_me_cl_link(struct mei_device *dev, struct mei_cl *cl, |
309 | const uuid_le *cguid, u8 host_client_id); | 308 | const uuid_le *cguid, u8 host_client_id); |
309 | void mei_me_cl_unlink(struct mei_device *dev, struct mei_cl *cl); | ||
310 | int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *cuuid); | 310 | int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *cuuid); |
311 | int mei_me_cl_by_id(struct mei_device *dev, u8 client_id); | 311 | int mei_me_cl_by_id(struct mei_device *dev, u8 client_id); |
312 | 312 | ||
diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c index 4fc2b3d4680a..636409f9667f 100644 --- a/drivers/misc/mei/wd.c +++ b/drivers/misc/mei/wd.c | |||
@@ -62,6 +62,7 @@ static void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout) | |||
62 | */ | 62 | */ |
63 | int mei_wd_host_init(struct mei_device *dev) | 63 | int mei_wd_host_init(struct mei_device *dev) |
64 | { | 64 | { |
65 | int id; | ||
65 | mei_cl_init(&dev->wd_cl, dev); | 66 | mei_cl_init(&dev->wd_cl, dev); |
66 | 67 | ||
67 | /* look for WD client and connect to it */ | 68 | /* look for WD client and connect to it */ |
@@ -69,12 +70,11 @@ int mei_wd_host_init(struct mei_device *dev) | |||
69 | dev->wd_timeout = MEI_WD_DEFAULT_TIMEOUT; | 70 | dev->wd_timeout = MEI_WD_DEFAULT_TIMEOUT; |
70 | dev->wd_state = MEI_WD_IDLE; | 71 | dev->wd_state = MEI_WD_IDLE; |
71 | 72 | ||
72 | /* find ME WD client */ | 73 | /* Connect WD ME client to the host client */ |
73 | mei_me_cl_update_filext(dev, &dev->wd_cl, | 74 | id = mei_me_cl_link(dev, &dev->wd_cl, |
74 | &mei_wd_guid, MEI_WD_HOST_CLIENT_ID); | 75 | &mei_wd_guid, MEI_WD_HOST_CLIENT_ID); |
75 | 76 | ||
76 | dev_dbg(&dev->pdev->dev, "wd: check client\n"); | 77 | if (id < 0) { |
77 | if (MEI_FILE_CONNECTING != dev->wd_cl.state) { | ||
78 | dev_info(&dev->pdev->dev, "wd: failed to find the client\n"); | 78 | dev_info(&dev->pdev->dev, "wd: failed to find the client\n"); |
79 | return -ENOENT; | 79 | return -ENOENT; |
80 | } | 80 | } |