diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2012-11-11 10:37:59 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-15 18:34:18 -0500 |
commit | db3ed43185c6f5d4fd6c5ac963347b849540996e (patch) | |
tree | 46690fbfd58c7d2da479865c7061f6c50b8d6d64 /drivers/misc | |
parent | e773efc405026bb8540c84bf45420bd66d5b34a7 (diff) |
mei: use type struct mei_cl *cl instead of void in struct mei_cb
We can use correct type 'struct mei_cl' instead of
'void *' for file_private in the struct mei_cb
as there is no other type assigned to this member of the structure
We rename the member from file_private to cl
Remove about 10 lines of declarations of temporary variables
used for type casting
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 | 14 | ||||
-rw-r--r-- | drivers/misc/mei/init.c | 6 | ||||
-rw-r--r-- | drivers/misc/mei/interrupt.c | 14 | ||||
-rw-r--r-- | drivers/misc/mei/iorw.c | 2 | ||||
-rw-r--r-- | drivers/misc/mei/main.c | 8 | ||||
-rw-r--r-- | drivers/misc/mei/mei_dev.h | 9 |
6 files changed, 24 insertions, 29 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c index 1de28df94da4..74d593fd6cbd 100644 --- a/drivers/misc/mei/amthif.c +++ b/drivers/misc/mei/amthif.c | |||
@@ -119,14 +119,12 @@ void mei_amthif_host_init(struct mei_device *dev) | |||
119 | struct mei_cl_cb *mei_amthif_find_read_list_entry(struct mei_device *dev, | 119 | struct mei_cl_cb *mei_amthif_find_read_list_entry(struct mei_device *dev, |
120 | struct file *file) | 120 | struct file *file) |
121 | { | 121 | { |
122 | struct mei_cl *cl_temp; | ||
123 | struct mei_cl_cb *pos = NULL; | 122 | struct mei_cl_cb *pos = NULL; |
124 | struct mei_cl_cb *next = NULL; | 123 | struct mei_cl_cb *next = NULL; |
125 | 124 | ||
126 | list_for_each_entry_safe(pos, next, | 125 | list_for_each_entry_safe(pos, next, |
127 | &dev->amthif_rd_complete_list.list, list) { | 126 | &dev->amthif_rd_complete_list.list, list) { |
128 | cl_temp = (struct mei_cl *)pos->file_private; | 127 | if (pos->cl && pos->cl == &dev->iamthif_cl && |
129 | if (cl_temp && cl_temp == &dev->iamthif_cl && | ||
130 | pos->file_object == file) | 128 | pos->file_object == file) |
131 | return pos; | 129 | return pos; |
132 | } | 130 | } |
@@ -370,7 +368,6 @@ int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb) | |||
370 | */ | 368 | */ |
371 | void mei_amthif_run_next_cmd(struct mei_device *dev) | 369 | void mei_amthif_run_next_cmd(struct mei_device *dev) |
372 | { | 370 | { |
373 | struct mei_cl *cl_tmp; | ||
374 | struct mei_cl_cb *pos = NULL; | 371 | struct mei_cl_cb *pos = NULL; |
375 | struct mei_cl_cb *next = NULL; | 372 | struct mei_cl_cb *next = NULL; |
376 | int status; | 373 | int status; |
@@ -390,9 +387,8 @@ void mei_amthif_run_next_cmd(struct mei_device *dev) | |||
390 | 387 | ||
391 | list_for_each_entry_safe(pos, next, &dev->amthif_cmd_list.list, list) { | 388 | list_for_each_entry_safe(pos, next, &dev->amthif_cmd_list.list, list) { |
392 | list_del(&pos->list); | 389 | list_del(&pos->list); |
393 | cl_tmp = (struct mei_cl *)pos->file_private; | ||
394 | 390 | ||
395 | if (cl_tmp && cl_tmp == &dev->iamthif_cl) { | 391 | if (pos->cl && pos->cl == &dev->iamthif_cl) { |
396 | status = mei_amthif_send_cmd(dev, pos); | 392 | status = mei_amthif_send_cmd(dev, pos); |
397 | if (status) { | 393 | if (status) { |
398 | dev_dbg(&dev->pdev->dev, | 394 | dev_dbg(&dev->pdev->dev, |
@@ -500,7 +496,6 @@ int mei_amthif_irq_process_completed(struct mei_device *dev, s32 *slots, | |||
500 | int mei_amthif_irq_read_message(struct mei_cl_cb *complete_list, | 496 | int mei_amthif_irq_read_message(struct mei_cl_cb *complete_list, |
501 | struct mei_device *dev, struct mei_msg_hdr *mei_hdr) | 497 | struct mei_device *dev, struct mei_msg_hdr *mei_hdr) |
502 | { | 498 | { |
503 | struct mei_cl *cl; | ||
504 | struct mei_cl_cb *cb; | 499 | struct mei_cl_cb *cb; |
505 | unsigned char *buffer; | 500 | unsigned char *buffer; |
506 | 501 | ||
@@ -528,14 +523,13 @@ int mei_amthif_irq_read_message(struct mei_cl_cb *complete_list, | |||
528 | cb = dev->iamthif_current_cb; | 523 | cb = dev->iamthif_current_cb; |
529 | dev->iamthif_current_cb = NULL; | 524 | dev->iamthif_current_cb = NULL; |
530 | 525 | ||
531 | cl = (struct mei_cl *)cb->file_private; | 526 | if (!cb->cl) |
532 | if (!cl) | ||
533 | return -ENODEV; | 527 | return -ENODEV; |
534 | 528 | ||
535 | dev->iamthif_stall_timer = 0; | 529 | dev->iamthif_stall_timer = 0; |
536 | cb->buf_idx = dev->iamthif_msg_buf_index; | 530 | cb->buf_idx = dev->iamthif_msg_buf_index; |
537 | cb->read_time = jiffies; | 531 | cb->read_time = jiffies; |
538 | if (dev->iamthif_ioctl && cl == &dev->iamthif_cl) { | 532 | if (dev->iamthif_ioctl && cb->cl == &dev->iamthif_cl) { |
539 | /* found the iamthif cb */ | 533 | /* found the iamthif cb */ |
540 | dev_dbg(&dev->pdev->dev, "complete the amthi read cb.\n "); | 534 | dev_dbg(&dev->pdev->dev, "complete the amthi read cb.\n "); |
541 | dev_dbg(&dev->pdev->dev, "add the amthi read cb to complete.\n "); | 535 | dev_dbg(&dev->pdev->dev, "add the amthi read cb to complete.\n "); |
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index 7e6d591fef49..0046ca505489 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c | |||
@@ -55,10 +55,8 @@ void mei_io_list_flush(struct mei_cl_cb *list, struct mei_cl *cl) | |||
55 | struct mei_cl_cb *next; | 55 | struct mei_cl_cb *next; |
56 | 56 | ||
57 | list_for_each_entry_safe(pos, next, &list->list, list) { | 57 | list_for_each_entry_safe(pos, next, &list->list, list) { |
58 | if (pos->file_private) { | 58 | if (pos->cl) { |
59 | struct mei_cl *cl_tmp; | 59 | if (mei_cl_cmp_id(cl, pos->cl)) |
60 | cl_tmp = (struct mei_cl *)pos->file_private; | ||
61 | if (mei_cl_cmp_id(cl, cl_tmp)) | ||
62 | list_del(&pos->list); | 60 | list_del(&pos->list); |
63 | } | 61 | } |
64 | } | 62 | } |
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c index 7193149678ec..acc994e3f20b 100644 --- a/drivers/misc/mei/interrupt.c +++ b/drivers/misc/mei/interrupt.c | |||
@@ -113,7 +113,7 @@ static int mei_irq_thread_read_client_message(struct mei_cl_cb *complete_list, | |||
113 | goto quit; | 113 | goto quit; |
114 | 114 | ||
115 | list_for_each_entry_safe(cb_pos, cb_next, &dev->read_list.list, list) { | 115 | list_for_each_entry_safe(cb_pos, cb_next, &dev->read_list.list, list) { |
116 | cl = (struct mei_cl *)cb_pos->file_private; | 116 | cl = cb_pos->cl; |
117 | if (cl && _mei_irq_thread_state_ok(cl, mei_hdr)) { | 117 | if (cl && _mei_irq_thread_state_ok(cl, mei_hdr)) { |
118 | cl->reading_state = MEI_READING; | 118 | cl->reading_state = MEI_READING; |
119 | buffer = cb_pos->response_buffer.data + cb_pos->buf_idx; | 119 | buffer = cb_pos->response_buffer.data + cb_pos->buf_idx; |
@@ -263,7 +263,7 @@ static void mei_client_connect_response(struct mei_device *dev, | |||
263 | } | 263 | } |
264 | list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) { | 264 | list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) { |
265 | 265 | ||
266 | cl = (struct mei_cl *)pos->file_private; | 266 | cl = pos->cl; |
267 | if (!cl) { | 267 | if (!cl) { |
268 | list_del(&pos->list); | 268 | list_del(&pos->list); |
269 | return; | 269 | return; |
@@ -301,7 +301,7 @@ static void mei_client_disconnect_response(struct mei_device *dev, | |||
301 | rs->status); | 301 | rs->status); |
302 | 302 | ||
303 | list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) { | 303 | list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) { |
304 | cl = (struct mei_cl *)pos->file_private; | 304 | cl = pos->cl; |
305 | 305 | ||
306 | if (!cl) { | 306 | if (!cl) { |
307 | list_del(&pos->list); | 307 | list_del(&pos->list); |
@@ -981,7 +981,7 @@ static int mei_irq_thread_write_handler(struct mei_cl_cb *cmpl_list, | |||
981 | 981 | ||
982 | list = &dev->write_waiting_list; | 982 | list = &dev->write_waiting_list; |
983 | list_for_each_entry_safe(pos, next, &list->list, list) { | 983 | list_for_each_entry_safe(pos, next, &list->list, list) { |
984 | cl = (struct mei_cl *)pos->file_private; | 984 | cl = pos->cl; |
985 | if (cl == NULL) | 985 | if (cl == NULL) |
986 | continue; | 986 | continue; |
987 | 987 | ||
@@ -1039,7 +1039,7 @@ static int mei_irq_thread_write_handler(struct mei_cl_cb *cmpl_list, | |||
1039 | /* complete control write list CB */ | 1039 | /* complete control write list CB */ |
1040 | dev_dbg(&dev->pdev->dev, "complete control write list cb.\n"); | 1040 | dev_dbg(&dev->pdev->dev, "complete control write list cb.\n"); |
1041 | list_for_each_entry_safe(pos, next, &dev->ctrl_wr_list.list, list) { | 1041 | list_for_each_entry_safe(pos, next, &dev->ctrl_wr_list.list, list) { |
1042 | cl = (struct mei_cl *) pos->file_private; | 1042 | cl = pos->cl; |
1043 | if (!cl) { | 1043 | if (!cl) { |
1044 | list_del(&pos->list); | 1044 | list_del(&pos->list); |
1045 | return -ENODEV; | 1045 | return -ENODEV; |
@@ -1077,7 +1077,7 @@ static int mei_irq_thread_write_handler(struct mei_cl_cb *cmpl_list, | |||
1077 | /* complete write list CB */ | 1077 | /* complete write list CB */ |
1078 | dev_dbg(&dev->pdev->dev, "complete write list cb.\n"); | 1078 | dev_dbg(&dev->pdev->dev, "complete write list cb.\n"); |
1079 | list_for_each_entry_safe(pos, next, &dev->write_list.list, list) { | 1079 | list_for_each_entry_safe(pos, next, &dev->write_list.list, list) { |
1080 | cl = (struct mei_cl *)pos->file_private; | 1080 | cl = pos->cl; |
1081 | if (cl == NULL) | 1081 | if (cl == NULL) |
1082 | continue; | 1082 | continue; |
1083 | 1083 | ||
@@ -1316,7 +1316,7 @@ end: | |||
1316 | 1316 | ||
1317 | 1317 | ||
1318 | list_for_each_entry_safe(cb_pos, cb_next, &complete_list.list, list) { | 1318 | list_for_each_entry_safe(cb_pos, cb_next, &complete_list.list, list) { |
1319 | cl = (struct mei_cl *)cb_pos->file_private; | 1319 | cl = cb_pos->cl; |
1320 | list_del(&cb_pos->list); | 1320 | list_del(&cb_pos->list); |
1321 | if (cl) { | 1321 | if (cl) { |
1322 | if (cl != &dev->iamthif_cl) { | 1322 | if (cl != &dev->iamthif_cl) { |
diff --git a/drivers/misc/mei/iorw.c b/drivers/misc/mei/iorw.c index a1d9ba1a06e7..cc53ce766e88 100644 --- a/drivers/misc/mei/iorw.c +++ b/drivers/misc/mei/iorw.c | |||
@@ -71,7 +71,7 @@ struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, struct file *fp) | |||
71 | mei_io_list_init(cb); | 71 | mei_io_list_init(cb); |
72 | 72 | ||
73 | cb->file_object = fp; | 73 | cb->file_object = fp; |
74 | cb->file_private = cl; | 74 | cb->cl = cl; |
75 | cb->buf_idx = 0; | 75 | cb->buf_idx = 0; |
76 | return cb; | 76 | return cb; |
77 | } | 77 | } |
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index bea545a5ae2b..e0e39c498d12 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -189,13 +189,9 @@ static struct mei_cl_cb *find_read_list_entry( | |||
189 | struct mei_cl_cb *next = NULL; | 189 | struct mei_cl_cb *next = NULL; |
190 | 190 | ||
191 | dev_dbg(&dev->pdev->dev, "remove read_list CB\n"); | 191 | dev_dbg(&dev->pdev->dev, "remove read_list CB\n"); |
192 | list_for_each_entry_safe(pos, next, &dev->read_list.list, list) { | 192 | list_for_each_entry_safe(pos, next, &dev->read_list.list, list) |
193 | struct mei_cl *cl_temp; | 193 | if (mei_cl_cmp_id(cl, pos->cl)) |
194 | cl_temp = (struct mei_cl *)pos->file_private; | ||
195 | |||
196 | if (mei_cl_cmp_id(cl, cl_temp)) | ||
197 | return pos; | 194 | return pos; |
198 | } | ||
199 | return NULL; | 195 | return NULL; |
200 | } | 196 | } |
201 | 197 | ||
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index ce246b0fb2d6..da0c1f5eed9c 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
@@ -143,10 +143,17 @@ struct mei_message_data { | |||
143 | }; | 143 | }; |
144 | 144 | ||
145 | 145 | ||
146 | struct mei_cl; | ||
147 | |||
148 | /* | ||
149 | * struct mei_cl_cb - file operation callback structure | ||
150 | * | ||
151 | * @cl - file client who is running this operation | ||
152 | */ | ||
146 | struct mei_cl_cb { | 153 | struct mei_cl_cb { |
147 | struct list_head list; | 154 | struct list_head list; |
155 | struct mei_cl *cl; | ||
148 | enum mei_cb_major_types major_file_operations; | 156 | enum mei_cb_major_types major_file_operations; |
149 | void *file_private; | ||
150 | struct mei_message_data request_buffer; | 157 | struct mei_message_data request_buffer; |
151 | struct mei_message_data response_buffer; | 158 | struct mei_message_data response_buffer; |
152 | unsigned long buf_idx; | 159 | unsigned long buf_idx; |