diff options
Diffstat (limited to 'drivers/misc/mei/main.c')
-rw-r--r-- | drivers/misc/mei/main.c | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index da9426054815..95f05d97a115 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | #include "mei_dev.h" | 42 | #include "mei_dev.h" |
43 | #include "interface.h" | 43 | #include "interface.h" |
44 | #include "client.h" | ||
44 | 45 | ||
45 | /* AMT device is a singleton on the platform */ | 46 | /* AMT device is a singleton on the platform */ |
46 | static struct pci_dev *mei_pdev; | 47 | static struct pci_dev *mei_pdev; |
@@ -91,28 +92,6 @@ static DEFINE_MUTEX(mei_mutex); | |||
91 | 92 | ||
92 | 93 | ||
93 | /** | 94 | /** |
94 | * find_read_list_entry - find read list entry | ||
95 | * | ||
96 | * @dev: device structure | ||
97 | * @file: pointer to file structure | ||
98 | * | ||
99 | * returns cb on success, NULL on error | ||
100 | */ | ||
101 | static struct mei_cl_cb *find_read_list_entry( | ||
102 | struct mei_device *dev, | ||
103 | struct mei_cl *cl) | ||
104 | { | ||
105 | struct mei_cl_cb *pos = NULL; | ||
106 | struct mei_cl_cb *next = NULL; | ||
107 | |||
108 | dev_dbg(&dev->pdev->dev, "remove read_list CB\n"); | ||
109 | list_for_each_entry_safe(pos, next, &dev->read_list.list, list) | ||
110 | if (mei_cl_cmp_id(cl, pos->cl)) | ||
111 | return pos; | ||
112 | return NULL; | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * mei_open - the open function | 95 | * mei_open - the open function |
117 | * | 96 | * |
118 | * @inode: pointer to inode structure | 97 | * @inode: pointer to inode structure |
@@ -217,7 +196,7 @@ static int mei_release(struct inode *inode, struct file *file) | |||
217 | "ME client = %d\n", | 196 | "ME client = %d\n", |
218 | cl->host_client_id, | 197 | cl->host_client_id, |
219 | cl->me_client_id); | 198 | cl->me_client_id); |
220 | rets = mei_disconnect_host_client(dev, cl); | 199 | rets = mei_cl_disconnect(cl); |
221 | } | 200 | } |
222 | mei_cl_flush_queues(cl); | 201 | mei_cl_flush_queues(cl); |
223 | dev_dbg(&dev->pdev->dev, "remove client host client = %d, ME client = %d\n", | 202 | dev_dbg(&dev->pdev->dev, "remove client host client = %d, ME client = %d\n", |
@@ -228,12 +207,12 @@ static int mei_release(struct inode *inode, struct file *file) | |||
228 | clear_bit(cl->host_client_id, dev->host_clients_map); | 207 | clear_bit(cl->host_client_id, dev->host_clients_map); |
229 | dev->open_handle_count--; | 208 | dev->open_handle_count--; |
230 | } | 209 | } |
231 | mei_me_cl_unlink(dev, cl); | 210 | mei_cl_unlink(cl); |
232 | 211 | ||
233 | /* free read cb */ | 212 | /* free read cb */ |
234 | cb = NULL; | 213 | cb = NULL; |
235 | if (cl->read_cb) { | 214 | if (cl->read_cb) { |
236 | cb = find_read_list_entry(dev, cl); | 215 | cb = mei_cl_find_read_cb(cl); |
237 | /* Remove entry from read list */ | 216 | /* Remove entry from read list */ |
238 | if (cb) | 217 | if (cb) |
239 | list_del(&cb->list); | 218 | list_del(&cb->list); |
@@ -323,7 +302,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, | |||
323 | goto out; | 302 | goto out; |
324 | } | 303 | } |
325 | 304 | ||
326 | err = mei_start_read(dev, cl); | 305 | err = mei_cl_read_start(cl); |
327 | if (err && err != -EBUSY) { | 306 | if (err && err != -EBUSY) { |
328 | dev_dbg(&dev->pdev->dev, | 307 | dev_dbg(&dev->pdev->dev, |
329 | "mei start read failure with status = %d\n", err); | 308 | "mei start read failure with status = %d\n", err); |
@@ -394,7 +373,7 @@ copy_buffer: | |||
394 | goto out; | 373 | goto out; |
395 | 374 | ||
396 | free: | 375 | free: |
397 | cb_pos = find_read_list_entry(dev, cl); | 376 | cb_pos = mei_cl_find_read_cb(cl); |
398 | /* Remove entry from read list */ | 377 | /* Remove entry from read list */ |
399 | if (cb_pos) | 378 | if (cb_pos) |
400 | list_del(&cb_pos->list); | 379 | list_del(&cb_pos->list); |
@@ -476,7 +455,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, | |||
476 | /* free entry used in read */ | 455 | /* free entry used in read */ |
477 | if (cl->reading_state == MEI_READ_COMPLETE) { | 456 | if (cl->reading_state == MEI_READ_COMPLETE) { |
478 | *offset = 0; | 457 | *offset = 0; |
479 | write_cb = find_read_list_entry(dev, cl); | 458 | write_cb = mei_cl_find_read_cb(cl); |
480 | if (write_cb) { | 459 | if (write_cb) { |
481 | list_del(&write_cb->list); | 460 | list_del(&write_cb->list); |
482 | mei_io_cb_free(write_cb); | 461 | mei_io_cb_free(write_cb); |
@@ -531,7 +510,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, | |||
531 | 510 | ||
532 | dev_dbg(&dev->pdev->dev, "host client = %d, ME client = %d\n", | 511 | dev_dbg(&dev->pdev->dev, "host client = %d, ME client = %d\n", |
533 | cl->host_client_id, cl->me_client_id); | 512 | cl->host_client_id, cl->me_client_id); |
534 | rets = mei_flow_ctrl_creds(dev, cl); | 513 | rets = mei_cl_flow_ctrl_creds(cl); |
535 | if (rets < 0) | 514 | if (rets < 0) |
536 | goto err; | 515 | goto err; |
537 | 516 | ||
@@ -565,7 +544,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, | |||
565 | 544 | ||
566 | out: | 545 | out: |
567 | if (mei_hdr.msg_complete) { | 546 | if (mei_hdr.msg_complete) { |
568 | if (mei_flow_ctrl_reduce(dev, cl)) { | 547 | if (mei_cl_flow_ctrl_reduce(cl)) { |
569 | rets = -ENODEV; | 548 | rets = -ENODEV; |
570 | goto err; | 549 | goto err; |
571 | } | 550 | } |
@@ -904,11 +883,11 @@ static void mei_remove(struct pci_dev *pdev) | |||
904 | 883 | ||
905 | if (dev->iamthif_cl.state == MEI_FILE_CONNECTED) { | 884 | if (dev->iamthif_cl.state == MEI_FILE_CONNECTED) { |
906 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTING; | 885 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTING; |
907 | mei_disconnect_host_client(dev, &dev->iamthif_cl); | 886 | mei_cl_disconnect(&dev->iamthif_cl); |
908 | } | 887 | } |
909 | if (dev->wd_cl.state == MEI_FILE_CONNECTED) { | 888 | if (dev->wd_cl.state == MEI_FILE_CONNECTED) { |
910 | dev->wd_cl.state = MEI_FILE_DISCONNECTING; | 889 | dev->wd_cl.state = MEI_FILE_DISCONNECTING; |
911 | mei_disconnect_host_client(dev, &dev->wd_cl); | 890 | mei_cl_disconnect(&dev->wd_cl); |
912 | } | 891 | } |
913 | 892 | ||
914 | /* Unregistering watchdog device */ | 893 | /* Unregistering watchdog device */ |
@@ -916,8 +895,8 @@ static void mei_remove(struct pci_dev *pdev) | |||
916 | 895 | ||
917 | /* remove entry if already in list */ | 896 | /* remove entry if already in list */ |
918 | dev_dbg(&pdev->dev, "list del iamthif and wd file list.\n"); | 897 | dev_dbg(&pdev->dev, "list del iamthif and wd file list.\n"); |
919 | mei_me_cl_unlink(dev, &dev->wd_cl); | 898 | mei_cl_unlink(&dev->wd_cl); |
920 | mei_me_cl_unlink(dev, &dev->iamthif_cl); | 899 | mei_cl_unlink(&dev->iamthif_cl); |
921 | 900 | ||
922 | dev->iamthif_current_cb = NULL; | 901 | dev->iamthif_current_cb = NULL; |
923 | dev->me_clients_num = 0; | 902 | dev->me_clients_num = 0; |