diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2012-10-15 06:06:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-24 18:36:39 -0400 |
commit | fb601adb350f82738210c0a1dc6af928a15391db (patch) | |
tree | bc230173aa912c64ca8aed863b5213a196e82ad3 /drivers/misc/mei/interrupt.c | |
parent | 75f0ee1559c5d51948e029041a9b722b3e3f0b83 (diff) |
mei: kill usless struct mei_io_list
kill useless mei_io_list list wrapper and use directly
struct mei_cl_cb mei_cb which was its only member for managing io queues
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/interrupt.c')
-rw-r--r-- | drivers/misc/mei/interrupt.c | 134 |
1 files changed, 58 insertions, 76 deletions
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c index 320ebd2f06ce..54d6f1a1dbc9 100644 --- a/drivers/misc/mei/interrupt.c +++ b/drivers/misc/mei/interrupt.c | |||
@@ -87,9 +87,8 @@ static void _mei_cmpl_iamthif(struct mei_device *dev, struct mei_cl_cb *cb_pos) | |||
87 | memcpy(cb_pos->response_buffer.data, | 87 | memcpy(cb_pos->response_buffer.data, |
88 | dev->iamthif_msg_buf, | 88 | dev->iamthif_msg_buf, |
89 | dev->iamthif_msg_buf_index); | 89 | dev->iamthif_msg_buf_index); |
90 | list_add_tail(&cb_pos->cb_list, | 90 | list_add_tail(&cb_pos->list, &dev->amthi_read_complete_list.list); |
91 | &dev->amthi_read_complete_list.mei_cb.cb_list); | 91 | dev_dbg(&dev->pdev->dev, "amthi read completed\n"); |
92 | dev_dbg(&dev->pdev->dev, "amthi read completed.\n"); | ||
93 | dev->iamthif_timer = jiffies; | 92 | dev->iamthif_timer = jiffies; |
94 | dev_dbg(&dev->pdev->dev, "dev->iamthif_timer = %ld\n", | 93 | dev_dbg(&dev->pdev->dev, "dev->iamthif_timer = %ld\n", |
95 | dev->iamthif_timer); | 94 | dev->iamthif_timer); |
@@ -112,7 +111,7 @@ static void _mei_cmpl_iamthif(struct mei_device *dev, struct mei_cl_cb *cb_pos) | |||
112 | * | 111 | * |
113 | * returns 0 on success, <0 on failure. | 112 | * returns 0 on success, <0 on failure. |
114 | */ | 113 | */ |
115 | static int mei_irq_thread_read_amthi_message(struct mei_io_list *complete_list, | 114 | static int mei_irq_thread_read_amthi_message(struct mei_cl_cb *complete_list, |
116 | struct mei_device *dev, | 115 | struct mei_device *dev, |
117 | struct mei_msg_hdr *mei_hdr) | 116 | struct mei_msg_hdr *mei_hdr) |
118 | { | 117 | { |
@@ -155,8 +154,7 @@ static int mei_irq_thread_read_amthi_message(struct mei_io_list *complete_list, | |||
155 | /* found the iamthif cb */ | 154 | /* found the iamthif cb */ |
156 | dev_dbg(&dev->pdev->dev, "complete the amthi read cb.\n "); | 155 | dev_dbg(&dev->pdev->dev, "complete the amthi read cb.\n "); |
157 | dev_dbg(&dev->pdev->dev, "add the amthi read cb to complete.\n "); | 156 | dev_dbg(&dev->pdev->dev, "add the amthi read cb to complete.\n "); |
158 | list_add_tail(&cb->cb_list, | 157 | list_add_tail(&cb->list, &complete_list->list); |
159 | &complete_list->mei_cb.cb_list); | ||
160 | } | 158 | } |
161 | return 0; | 159 | return 0; |
162 | } | 160 | } |
@@ -188,7 +186,7 @@ static int _mei_irq_thread_state_ok(struct mei_cl *cl, | |||
188 | * | 186 | * |
189 | * returns 0 on success, <0 on failure. | 187 | * returns 0 on success, <0 on failure. |
190 | */ | 188 | */ |
191 | static int mei_irq_thread_read_client_message(struct mei_io_list *complete_list, | 189 | static int mei_irq_thread_read_client_message(struct mei_cl_cb *complete_list, |
192 | struct mei_device *dev, | 190 | struct mei_device *dev, |
193 | struct mei_msg_hdr *mei_hdr) | 191 | struct mei_msg_hdr *mei_hdr) |
194 | { | 192 | { |
@@ -197,11 +195,10 @@ static int mei_irq_thread_read_client_message(struct mei_io_list *complete_list, | |||
197 | unsigned char *buffer = NULL; | 195 | unsigned char *buffer = NULL; |
198 | 196 | ||
199 | dev_dbg(&dev->pdev->dev, "start client msg\n"); | 197 | dev_dbg(&dev->pdev->dev, "start client msg\n"); |
200 | if (list_empty(&dev->read_list.mei_cb.cb_list)) | 198 | if (list_empty(&dev->read_list.list)) |
201 | goto quit; | 199 | goto quit; |
202 | 200 | ||
203 | list_for_each_entry_safe(cb_pos, cb_next, | 201 | list_for_each_entry_safe(cb_pos, cb_next, &dev->read_list.list, list) { |
204 | &dev->read_list.mei_cb.cb_list, cb_list) { | ||
205 | cl = (struct mei_cl *)cb_pos->file_private; | 202 | cl = (struct mei_cl *)cb_pos->file_private; |
206 | if (cl && _mei_irq_thread_state_ok(cl, mei_hdr)) { | 203 | if (cl && _mei_irq_thread_state_ok(cl, mei_hdr)) { |
207 | cl->reading_state = MEI_READING; | 204 | cl->reading_state = MEI_READING; |
@@ -210,7 +207,7 @@ static int mei_irq_thread_read_client_message(struct mei_io_list *complete_list, | |||
210 | if (cb_pos->response_buffer.size < | 207 | if (cb_pos->response_buffer.size < |
211 | mei_hdr->length + cb_pos->buf_idx) { | 208 | mei_hdr->length + cb_pos->buf_idx) { |
212 | dev_dbg(&dev->pdev->dev, "message overflow.\n"); | 209 | dev_dbg(&dev->pdev->dev, "message overflow.\n"); |
213 | list_del(&cb_pos->cb_list); | 210 | list_del(&cb_pos->list); |
214 | return -ENOMEM; | 211 | return -ENOMEM; |
215 | } | 212 | } |
216 | if (buffer) | 213 | if (buffer) |
@@ -219,15 +216,15 @@ static int mei_irq_thread_read_client_message(struct mei_io_list *complete_list, | |||
219 | cb_pos->buf_idx += mei_hdr->length; | 216 | cb_pos->buf_idx += mei_hdr->length; |
220 | if (mei_hdr->msg_complete) { | 217 | if (mei_hdr->msg_complete) { |
221 | cl->status = 0; | 218 | cl->status = 0; |
222 | list_del(&cb_pos->cb_list); | 219 | list_del(&cb_pos->list); |
223 | dev_dbg(&dev->pdev->dev, | 220 | dev_dbg(&dev->pdev->dev, |
224 | "completed read H cl = %d, ME cl = %d, length = %lu\n", | 221 | "completed read H cl = %d, ME cl = %d, length = %lu\n", |
225 | cl->host_client_id, | 222 | cl->host_client_id, |
226 | cl->me_client_id, | 223 | cl->me_client_id, |
227 | cb_pos->buf_idx); | 224 | cb_pos->buf_idx); |
228 | 225 | ||
229 | list_add_tail(&cb_pos->cb_list, | 226 | list_add_tail(&cb_pos->list, |
230 | &complete_list->mei_cb.cb_list); | 227 | &complete_list->list); |
231 | } | 228 | } |
232 | 229 | ||
233 | break; | 230 | break; |
@@ -291,7 +288,7 @@ static int _mei_irq_thread_iamthif_read(struct mei_device *dev, s32 *slots) | |||
291 | static int _mei_irq_thread_close(struct mei_device *dev, s32 *slots, | 288 | static int _mei_irq_thread_close(struct mei_device *dev, s32 *slots, |
292 | struct mei_cl_cb *cb_pos, | 289 | struct mei_cl_cb *cb_pos, |
293 | struct mei_cl *cl, | 290 | struct mei_cl *cl, |
294 | struct mei_io_list *cmpl_list) | 291 | struct mei_cl_cb *cmpl_list) |
295 | { | 292 | { |
296 | if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) + | 293 | if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) + |
297 | sizeof(struct hbm_client_disconnect_request))) | 294 | sizeof(struct hbm_client_disconnect_request))) |
@@ -302,15 +299,13 @@ static int _mei_irq_thread_close(struct mei_device *dev, s32 *slots, | |||
302 | if (mei_disconnect(dev, cl)) { | 299 | if (mei_disconnect(dev, cl)) { |
303 | cl->status = 0; | 300 | cl->status = 0; |
304 | cb_pos->buf_idx = 0; | 301 | cb_pos->buf_idx = 0; |
305 | list_move_tail(&cb_pos->cb_list, | 302 | list_move_tail(&cb_pos->list, &cmpl_list->list); |
306 | &cmpl_list->mei_cb.cb_list); | ||
307 | return -EMSGSIZE; | 303 | return -EMSGSIZE; |
308 | } else { | 304 | } else { |
309 | cl->state = MEI_FILE_DISCONNECTING; | 305 | cl->state = MEI_FILE_DISCONNECTING; |
310 | cl->status = 0; | 306 | cl->status = 0; |
311 | cb_pos->buf_idx = 0; | 307 | cb_pos->buf_idx = 0; |
312 | list_move_tail(&cb_pos->cb_list, | 308 | list_move_tail(&cb_pos->list, &dev->ctrl_rd_list.list); |
313 | &dev->ctrl_rd_list.mei_cb.cb_list); | ||
314 | cl->timer_count = MEI_CONNECT_TIMEOUT; | 309 | cl->timer_count = MEI_CONNECT_TIMEOUT; |
315 | } | 310 | } |
316 | 311 | ||
@@ -357,7 +352,7 @@ static void mei_client_connect_response(struct mei_device *dev, | |||
357 | { | 352 | { |
358 | 353 | ||
359 | struct mei_cl *cl; | 354 | struct mei_cl *cl; |
360 | struct mei_cl_cb *cb_pos = NULL, *cb_next = NULL; | 355 | struct mei_cl_cb *pos = NULL, *next = NULL; |
361 | 356 | ||
362 | dev_dbg(&dev->pdev->dev, | 357 | dev_dbg(&dev->pdev->dev, |
363 | "connect_response:\n" | 358 | "connect_response:\n" |
@@ -383,17 +378,16 @@ static void mei_client_connect_response(struct mei_device *dev, | |||
383 | dev->iamthif_state = MEI_IAMTHIF_IDLE; | 378 | dev->iamthif_state = MEI_IAMTHIF_IDLE; |
384 | return; | 379 | return; |
385 | } | 380 | } |
386 | list_for_each_entry_safe(cb_pos, cb_next, | 381 | list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) { |
387 | &dev->ctrl_rd_list.mei_cb.cb_list, cb_list) { | ||
388 | 382 | ||
389 | cl = (struct mei_cl *)cb_pos->file_private; | 383 | cl = (struct mei_cl *)pos->file_private; |
390 | if (!cl) { | 384 | if (!cl) { |
391 | list_del(&cb_pos->cb_list); | 385 | list_del(&pos->list); |
392 | return; | 386 | return; |
393 | } | 387 | } |
394 | if (MEI_IOCTL == cb_pos->major_file_operations) { | 388 | if (MEI_IOCTL == pos->major_file_operations) { |
395 | if (is_treat_specially_client(cl, rs)) { | 389 | if (is_treat_specially_client(cl, rs)) { |
396 | list_del(&cb_pos->cb_list); | 390 | list_del(&pos->list); |
397 | cl->status = 0; | 391 | cl->status = 0; |
398 | cl->timer_count = 0; | 392 | cl->timer_count = 0; |
399 | break; | 393 | break; |
@@ -412,7 +406,7 @@ static void mei_client_disconnect_response(struct mei_device *dev, | |||
412 | struct hbm_client_connect_response *rs) | 406 | struct hbm_client_connect_response *rs) |
413 | { | 407 | { |
414 | struct mei_cl *cl; | 408 | struct mei_cl *cl; |
415 | struct mei_cl_cb *cb_pos = NULL, *cb_next = NULL; | 409 | struct mei_cl_cb *pos = NULL, *next = NULL; |
416 | 410 | ||
417 | dev_dbg(&dev->pdev->dev, | 411 | dev_dbg(&dev->pdev->dev, |
418 | "disconnect_response:\n" | 412 | "disconnect_response:\n" |
@@ -423,12 +417,11 @@ static void mei_client_disconnect_response(struct mei_device *dev, | |||
423 | rs->host_addr, | 417 | rs->host_addr, |
424 | rs->status); | 418 | rs->status); |
425 | 419 | ||
426 | list_for_each_entry_safe(cb_pos, cb_next, | 420 | list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) { |
427 | &dev->ctrl_rd_list.mei_cb.cb_list, cb_list) { | 421 | cl = (struct mei_cl *)pos->file_private; |
428 | cl = (struct mei_cl *)cb_pos->file_private; | ||
429 | 422 | ||
430 | if (!cl) { | 423 | if (!cl) { |
431 | list_del(&cb_pos->cb_list); | 424 | list_del(&pos->list); |
432 | return; | 425 | return; |
433 | } | 426 | } |
434 | 427 | ||
@@ -436,7 +429,7 @@ static void mei_client_disconnect_response(struct mei_device *dev, | |||
436 | if (cl->host_client_id == rs->host_addr && | 429 | if (cl->host_client_id == rs->host_addr && |
437 | cl->me_client_id == rs->me_addr) { | 430 | cl->me_client_id == rs->me_addr) { |
438 | 431 | ||
439 | list_del(&cb_pos->cb_list); | 432 | list_del(&pos->list); |
440 | if (!rs->status) | 433 | if (!rs->status) |
441 | cl->state = MEI_FILE_DISCONNECTED; | 434 | cl->state = MEI_FILE_DISCONNECTED; |
442 | 435 | ||
@@ -822,12 +815,12 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
822 | static int _mei_irq_thread_read(struct mei_device *dev, s32 *slots, | 815 | static int _mei_irq_thread_read(struct mei_device *dev, s32 *slots, |
823 | struct mei_cl_cb *cb_pos, | 816 | struct mei_cl_cb *cb_pos, |
824 | struct mei_cl *cl, | 817 | struct mei_cl *cl, |
825 | struct mei_io_list *cmpl_list) | 818 | struct mei_cl_cb *cmpl_list) |
826 | { | 819 | { |
827 | if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) + | 820 | if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) + |
828 | sizeof(struct hbm_flow_control))) { | 821 | sizeof(struct hbm_flow_control))) { |
829 | /* return the cancel routine */ | 822 | /* return the cancel routine */ |
830 | list_del(&cb_pos->cb_list); | 823 | list_del(&cb_pos->list); |
831 | return -EBADMSG; | 824 | return -EBADMSG; |
832 | } | 825 | } |
833 | 826 | ||
@@ -836,10 +829,10 @@ static int _mei_irq_thread_read(struct mei_device *dev, s32 *slots, | |||
836 | if (mei_send_flow_control(dev, cl)) { | 829 | if (mei_send_flow_control(dev, cl)) { |
837 | cl->status = -ENODEV; | 830 | cl->status = -ENODEV; |
838 | cb_pos->buf_idx = 0; | 831 | cb_pos->buf_idx = 0; |
839 | list_move_tail(&cb_pos->cb_list, &cmpl_list->mei_cb.cb_list); | 832 | list_move_tail(&cb_pos->list, &cmpl_list->list); |
840 | return -ENODEV; | 833 | return -ENODEV; |
841 | } | 834 | } |
842 | list_move_tail(&cb_pos->cb_list, &dev->read_list.mei_cb.cb_list); | 835 | list_move_tail(&cb_pos->list, &dev->read_list.list); |
843 | 836 | ||
844 | return 0; | 837 | return 0; |
845 | } | 838 | } |
@@ -859,12 +852,12 @@ static int _mei_irq_thread_read(struct mei_device *dev, s32 *slots, | |||
859 | static int _mei_irq_thread_ioctl(struct mei_device *dev, s32 *slots, | 852 | static int _mei_irq_thread_ioctl(struct mei_device *dev, s32 *slots, |
860 | struct mei_cl_cb *cb_pos, | 853 | struct mei_cl_cb *cb_pos, |
861 | struct mei_cl *cl, | 854 | struct mei_cl *cl, |
862 | struct mei_io_list *cmpl_list) | 855 | struct mei_cl_cb *cmpl_list) |
863 | { | 856 | { |
864 | if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) + | 857 | if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) + |
865 | sizeof(struct hbm_client_connect_request))) { | 858 | sizeof(struct hbm_client_connect_request))) { |
866 | /* return the cancel routine */ | 859 | /* return the cancel routine */ |
867 | list_del(&cb_pos->cb_list); | 860 | list_del(&cb_pos->list); |
868 | return -EBADMSG; | 861 | return -EBADMSG; |
869 | } | 862 | } |
870 | 863 | ||
@@ -873,11 +866,10 @@ static int _mei_irq_thread_ioctl(struct mei_device *dev, s32 *slots, | |||
873 | if (mei_connect(dev, cl)) { | 866 | if (mei_connect(dev, cl)) { |
874 | cl->status = -ENODEV; | 867 | cl->status = -ENODEV; |
875 | cb_pos->buf_idx = 0; | 868 | cb_pos->buf_idx = 0; |
876 | list_del(&cb_pos->cb_list); | 869 | list_del(&cb_pos->list); |
877 | return -ENODEV; | 870 | return -ENODEV; |
878 | } else { | 871 | } else { |
879 | list_move_tail(&cb_pos->cb_list, | 872 | list_move_tail(&cb_pos->list, &dev->ctrl_rd_list.list); |
880 | &dev->ctrl_rd_list.mei_cb.cb_list); | ||
881 | cl->timer_count = MEI_CONNECT_TIMEOUT; | 873 | cl->timer_count = MEI_CONNECT_TIMEOUT; |
882 | } | 874 | } |
883 | return 0; | 875 | return 0; |
@@ -897,7 +889,7 @@ static int _mei_irq_thread_ioctl(struct mei_device *dev, s32 *slots, | |||
897 | static int _mei_irq_thread_cmpl(struct mei_device *dev, s32 *slots, | 889 | static int _mei_irq_thread_cmpl(struct mei_device *dev, s32 *slots, |
898 | struct mei_cl_cb *cb_pos, | 890 | struct mei_cl_cb *cb_pos, |
899 | struct mei_cl *cl, | 891 | struct mei_cl *cl, |
900 | struct mei_io_list *cmpl_list) | 892 | struct mei_cl_cb *cmpl_list) |
901 | { | 893 | { |
902 | struct mei_msg_hdr *mei_hdr; | 894 | struct mei_msg_hdr *mei_hdr; |
903 | 895 | ||
@@ -924,16 +916,14 @@ static int _mei_irq_thread_cmpl(struct mei_device *dev, s32 *slots, | |||
924 | cb_pos->buf_idx), | 916 | cb_pos->buf_idx), |
925 | mei_hdr->length)) { | 917 | mei_hdr->length)) { |
926 | cl->status = -ENODEV; | 918 | cl->status = -ENODEV; |
927 | list_move_tail(&cb_pos->cb_list, | 919 | list_move_tail(&cb_pos->list, &cmpl_list->list); |
928 | &cmpl_list->mei_cb.cb_list); | ||
929 | return -ENODEV; | 920 | return -ENODEV; |
930 | } else { | 921 | } else { |
931 | if (mei_flow_ctrl_reduce(dev, cl)) | 922 | if (mei_flow_ctrl_reduce(dev, cl)) |
932 | return -ENODEV; | 923 | return -ENODEV; |
933 | cl->status = 0; | 924 | cl->status = 0; |
934 | cb_pos->buf_idx += mei_hdr->length; | 925 | cb_pos->buf_idx += mei_hdr->length; |
935 | list_move_tail(&cb_pos->cb_list, | 926 | list_move_tail(&cb_pos->list, &dev->write_waiting_list.list); |
936 | &dev->write_waiting_list.mei_cb.cb_list); | ||
937 | } | 927 | } |
938 | } else if (*slots == dev->hbuf_depth) { | 928 | } else if (*slots == dev->hbuf_depth) { |
939 | /* buffer is still empty */ | 929 | /* buffer is still empty */ |
@@ -951,8 +941,7 @@ static int _mei_irq_thread_cmpl(struct mei_device *dev, s32 *slots, | |||
951 | cb_pos->buf_idx), | 941 | cb_pos->buf_idx), |
952 | mei_hdr->length)) { | 942 | mei_hdr->length)) { |
953 | cl->status = -ENODEV; | 943 | cl->status = -ENODEV; |
954 | list_move_tail(&cb_pos->cb_list, | 944 | list_move_tail(&cb_pos->list, &cmpl_list->list); |
955 | &cmpl_list->mei_cb.cb_list); | ||
956 | return -ENODEV; | 945 | return -ENODEV; |
957 | } else { | 946 | } else { |
958 | cb_pos->buf_idx += mei_hdr->length; | 947 | cb_pos->buf_idx += mei_hdr->length; |
@@ -988,7 +977,7 @@ static int _mei_irq_thread_cmpl(struct mei_device *dev, s32 *slots, | |||
988 | static int _mei_irq_thread_cmpl_iamthif(struct mei_device *dev, s32 *slots, | 977 | static int _mei_irq_thread_cmpl_iamthif(struct mei_device *dev, s32 *slots, |
989 | struct mei_cl_cb *cb_pos, | 978 | struct mei_cl_cb *cb_pos, |
990 | struct mei_cl *cl, | 979 | struct mei_cl *cl, |
991 | struct mei_io_list *cmpl_list) | 980 | struct mei_cl_cb *cmpl_list) |
992 | { | 981 | { |
993 | struct mei_msg_hdr *mei_hdr; | 982 | struct mei_msg_hdr *mei_hdr; |
994 | 983 | ||
@@ -1011,7 +1000,7 @@ static int _mei_irq_thread_cmpl_iamthif(struct mei_device *dev, s32 *slots, | |||
1011 | mei_hdr->length)) { | 1000 | mei_hdr->length)) { |
1012 | dev->iamthif_state = MEI_IAMTHIF_IDLE; | 1001 | dev->iamthif_state = MEI_IAMTHIF_IDLE; |
1013 | cl->status = -ENODEV; | 1002 | cl->status = -ENODEV; |
1014 | list_del(&cb_pos->cb_list); | 1003 | list_del(&cb_pos->list); |
1015 | return -ENODEV; | 1004 | return -ENODEV; |
1016 | } else { | 1005 | } else { |
1017 | if (mei_flow_ctrl_reduce(dev, cl)) | 1006 | if (mei_flow_ctrl_reduce(dev, cl)) |
@@ -1023,8 +1012,7 @@ static int _mei_irq_thread_cmpl_iamthif(struct mei_device *dev, s32 *slots, | |||
1023 | dev->iamthif_flow_control_pending = true; | 1012 | dev->iamthif_flow_control_pending = true; |
1024 | /* save iamthif cb sent to amthi client */ | 1013 | /* save iamthif cb sent to amthi client */ |
1025 | dev->iamthif_current_cb = cb_pos; | 1014 | dev->iamthif_current_cb = cb_pos; |
1026 | list_move_tail(&cb_pos->cb_list, | 1015 | list_move_tail(&cb_pos->list, &dev->write_waiting_list.list); |
1027 | &dev->write_waiting_list.mei_cb.cb_list); | ||
1028 | 1016 | ||
1029 | } | 1017 | } |
1030 | } else if (*slots == dev->hbuf_depth) { | 1018 | } else if (*slots == dev->hbuf_depth) { |
@@ -1044,7 +1032,7 @@ static int _mei_irq_thread_cmpl_iamthif(struct mei_device *dev, s32 *slots, | |||
1044 | dev->iamthif_msg_buf_index), | 1032 | dev->iamthif_msg_buf_index), |
1045 | mei_hdr->length)) { | 1033 | mei_hdr->length)) { |
1046 | cl->status = -ENODEV; | 1034 | cl->status = -ENODEV; |
1047 | list_del(&cb_pos->cb_list); | 1035 | list_del(&cb_pos->list); |
1048 | } else { | 1036 | } else { |
1049 | dev->iamthif_msg_buf_index += mei_hdr->length; | 1037 | dev->iamthif_msg_buf_index += mei_hdr->length; |
1050 | } | 1038 | } |
@@ -1066,7 +1054,7 @@ static int _mei_irq_thread_cmpl_iamthif(struct mei_device *dev, s32 *slots, | |||
1066 | * | 1054 | * |
1067 | * returns 0 on success, <0 on failure. | 1055 | * returns 0 on success, <0 on failure. |
1068 | */ | 1056 | */ |
1069 | static int mei_irq_thread_read_handler(struct mei_io_list *cmpl_list, | 1057 | static int mei_irq_thread_read_handler(struct mei_cl_cb *cmpl_list, |
1070 | struct mei_device *dev, | 1058 | struct mei_device *dev, |
1071 | s32 *slots) | 1059 | s32 *slots) |
1072 | { | 1060 | { |
@@ -1169,14 +1157,13 @@ end: | |||
1169 | * | 1157 | * |
1170 | * returns 0 on success, <0 on failure. | 1158 | * returns 0 on success, <0 on failure. |
1171 | */ | 1159 | */ |
1172 | static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list, | 1160 | static int mei_irq_thread_write_handler(struct mei_cl_cb *cmpl_list, |
1173 | struct mei_device *dev, | 1161 | struct mei_device *dev, s32 *slots) |
1174 | s32 *slots) | ||
1175 | { | 1162 | { |
1176 | 1163 | ||
1177 | struct mei_cl *cl; | 1164 | struct mei_cl *cl; |
1178 | struct mei_cl_cb *pos = NULL, *next = NULL; | 1165 | struct mei_cl_cb *pos = NULL, *next = NULL; |
1179 | struct mei_io_list *list; | 1166 | struct mei_cl_cb *list; |
1180 | int ret; | 1167 | int ret; |
1181 | 1168 | ||
1182 | if (!mei_hbuf_is_empty(dev)) { | 1169 | if (!mei_hbuf_is_empty(dev)) { |
@@ -1191,20 +1178,19 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list, | |||
1191 | dev_dbg(&dev->pdev->dev, "complete all waiting for write cb.\n"); | 1178 | dev_dbg(&dev->pdev->dev, "complete all waiting for write cb.\n"); |
1192 | 1179 | ||
1193 | list = &dev->write_waiting_list; | 1180 | list = &dev->write_waiting_list; |
1194 | list_for_each_entry_safe(pos, next, &list->mei_cb.cb_list, cb_list) { | 1181 | list_for_each_entry_safe(pos, next, &list->list, list) { |
1195 | cl = (struct mei_cl *)pos->file_private; | 1182 | cl = (struct mei_cl *)pos->file_private; |
1196 | if (cl == NULL) | 1183 | if (cl == NULL) |
1197 | continue; | 1184 | continue; |
1198 | 1185 | ||
1199 | cl->status = 0; | 1186 | cl->status = 0; |
1200 | list_del(&pos->cb_list); | 1187 | list_del(&pos->list); |
1201 | if (MEI_WRITING == cl->writing_state && | 1188 | if (MEI_WRITING == cl->writing_state && |
1202 | (pos->major_file_operations == MEI_WRITE) && | 1189 | (pos->major_file_operations == MEI_WRITE) && |
1203 | (cl != &dev->iamthif_cl)) { | 1190 | (cl != &dev->iamthif_cl)) { |
1204 | dev_dbg(&dev->pdev->dev, "MEI WRITE COMPLETE\n"); | 1191 | dev_dbg(&dev->pdev->dev, "MEI WRITE COMPLETE\n"); |
1205 | cl->writing_state = MEI_WRITE_COMPLETE; | 1192 | cl->writing_state = MEI_WRITE_COMPLETE; |
1206 | list_add_tail(&pos->cb_list, | 1193 | list_add_tail(&pos->list, &cmpl_list->list); |
1207 | &cmpl_list->mei_cb.cb_list); | ||
1208 | } | 1194 | } |
1209 | if (cl == &dev->iamthif_cl) { | 1195 | if (cl == &dev->iamthif_cl) { |
1210 | dev_dbg(&dev->pdev->dev, "check iamthif flow control.\n"); | 1196 | dev_dbg(&dev->pdev->dev, "check iamthif flow control.\n"); |
@@ -1250,11 +1236,10 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list, | |||
1250 | 1236 | ||
1251 | /* complete control write list CB */ | 1237 | /* complete control write list CB */ |
1252 | dev_dbg(&dev->pdev->dev, "complete control write list cb.\n"); | 1238 | dev_dbg(&dev->pdev->dev, "complete control write list cb.\n"); |
1253 | list_for_each_entry_safe(pos, next, | 1239 | list_for_each_entry_safe(pos, next, &dev->ctrl_wr_list.list, list) { |
1254 | &dev->ctrl_wr_list.mei_cb.cb_list, cb_list) { | ||
1255 | cl = (struct mei_cl *) pos->file_private; | 1240 | cl = (struct mei_cl *) pos->file_private; |
1256 | if (!cl) { | 1241 | if (!cl) { |
1257 | list_del(&pos->cb_list); | 1242 | list_del(&pos->list); |
1258 | return -ENODEV; | 1243 | return -ENODEV; |
1259 | } | 1244 | } |
1260 | switch (pos->major_file_operations) { | 1245 | switch (pos->major_file_operations) { |
@@ -1289,8 +1274,7 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list, | |||
1289 | } | 1274 | } |
1290 | /* complete write list CB */ | 1275 | /* complete write list CB */ |
1291 | dev_dbg(&dev->pdev->dev, "complete write list cb.\n"); | 1276 | dev_dbg(&dev->pdev->dev, "complete write list cb.\n"); |
1292 | list_for_each_entry_safe(pos, next, | 1277 | list_for_each_entry_safe(pos, next, &dev->write_list.list, list) { |
1293 | &dev->write_list.mei_cb.cb_list, cb_list) { | ||
1294 | cl = (struct mei_cl *)pos->file_private; | 1278 | cl = (struct mei_cl *)pos->file_private; |
1295 | if (cl == NULL) | 1279 | if (cl == NULL) |
1296 | continue; | 1280 | continue; |
@@ -1410,16 +1394,15 @@ void mei_timer(struct work_struct *work) | |||
1410 | 1394 | ||
1411 | dev_dbg(&dev->pdev->dev, "freeing AMTHI for other requests\n"); | 1395 | dev_dbg(&dev->pdev->dev, "freeing AMTHI for other requests\n"); |
1412 | 1396 | ||
1413 | amthi_complete_list = &dev->amthi_read_complete_list. | 1397 | amthi_complete_list = &dev->amthi_read_complete_list.list; |
1414 | mei_cb.cb_list; | ||
1415 | 1398 | ||
1416 | list_for_each_entry_safe(cb_pos, cb_next, amthi_complete_list, cb_list) { | 1399 | list_for_each_entry_safe(cb_pos, cb_next, amthi_complete_list, list) { |
1417 | 1400 | ||
1418 | cl_pos = cb_pos->file_object->private_data; | 1401 | cl_pos = cb_pos->file_object->private_data; |
1419 | 1402 | ||
1420 | /* Finding the AMTHI entry. */ | 1403 | /* Finding the AMTHI entry. */ |
1421 | if (cl_pos == &dev->iamthif_cl) | 1404 | if (cl_pos == &dev->iamthif_cl) |
1422 | list_del(&cb_pos->cb_list); | 1405 | list_del(&cb_pos->list); |
1423 | } | 1406 | } |
1424 | if (dev->iamthif_current_cb) | 1407 | if (dev->iamthif_current_cb) |
1425 | mei_free_cb_private(dev->iamthif_current_cb); | 1408 | mei_free_cb_private(dev->iamthif_current_cb); |
@@ -1450,7 +1433,7 @@ out: | |||
1450 | irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id) | 1433 | irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id) |
1451 | { | 1434 | { |
1452 | struct mei_device *dev = (struct mei_device *) dev_id; | 1435 | struct mei_device *dev = (struct mei_device *) dev_id; |
1453 | struct mei_io_list complete_list; | 1436 | struct mei_cl_cb complete_list; |
1454 | struct mei_cl_cb *cb_pos = NULL, *cb_next = NULL; | 1437 | struct mei_cl_cb *cb_pos = NULL, *cb_next = NULL; |
1455 | struct mei_cl *cl; | 1438 | struct mei_cl *cl; |
1456 | s32 slots; | 1439 | s32 slots; |
@@ -1530,14 +1513,13 @@ end: | |||
1530 | wake_up_interruptible(&dev->wait_recvd_msg); | 1513 | wake_up_interruptible(&dev->wait_recvd_msg); |
1531 | bus_message_received = false; | 1514 | bus_message_received = false; |
1532 | } | 1515 | } |
1533 | if (list_empty(&complete_list.mei_cb.cb_list)) | 1516 | if (list_empty(&complete_list.list)) |
1534 | return IRQ_HANDLED; | 1517 | return IRQ_HANDLED; |
1535 | 1518 | ||
1536 | 1519 | ||
1537 | list_for_each_entry_safe(cb_pos, cb_next, | 1520 | list_for_each_entry_safe(cb_pos, cb_next, &complete_list.list, list) { |
1538 | &complete_list.mei_cb.cb_list, cb_list) { | ||
1539 | cl = (struct mei_cl *)cb_pos->file_private; | 1521 | cl = (struct mei_cl *)cb_pos->file_private; |
1540 | list_del(&cb_pos->cb_list); | 1522 | list_del(&cb_pos->list); |
1541 | if (cl) { | 1523 | if (cl) { |
1542 | if (cl != &dev->iamthif_cl) { | 1524 | if (cl != &dev->iamthif_cl) { |
1543 | dev_dbg(&dev->pdev->dev, "completing call back.\n"); | 1525 | dev_dbg(&dev->pdev->dev, "completing call back.\n"); |