mei: kill usless struct mei_io_list
Subsystems (2)
PATCH v3 4/6 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 <[email protected]>
---
V2: drivers/misc/mei/init.c: line 689 was exidently removed
V3: grrr, I cannot just put old line back.
drivers/misc/mei/init.c | 31 +++------- drivers/misc/mei/interrupt.c | 134 ++++++++++++++++++------------------------ drivers/misc/mei/iorw.c | 34 +++++------ drivers/misc/mei/main.c | 43 ++++++-------- drivers/misc/mei/mei_dev.h | 32 ++++++----- 5 files changed, 118 insertions(+), 156 deletions(-)
drivers/misc/mei/init.c +9 -22
@@ -48,34 +48,22 @@ const uuid_le mei_amthi_guid = UUID_LE(0x12f80028, 0xb4b7, 0x4b2d, 0xac, 0x81, 0x4c);/** -* mei_io_list_init - Sets up a queue list. -* -* @list: An instance io list structure -* @dev: the device structure -*/ -void mei_io_list_init (struct mei_io_list *list) -{ -/* initialize our queue list */ -INIT_LIST_HEAD (&list->mei_cb.cb_list); -} - -/** * mei_io_list_flush - removes list entry belonging to cl. * * @list: An instance of our list structure * @cl: private data of the file object */ -void mei_io_list_flush (struct mei_io_list *list,struct mei_cl *cl) +void mei_io_list_flush (struct mei_cl_cb *list,struct mei_cl *cl) {struct mei_cl_cb *pos;struct mei_cl_cb *next; -list_for_each_entry_safe (pos, next, &list->mei_cb.cb_list, cb_list) { +list_for_each_entry_safe (pos, next, &list->list, list) {if (pos->file_private) {struct mei_cl *cl_tmp; cl_tmp = (struct mei_cl *)pos->file_private;if (mei_cl_cmp_id (cl, cl_tmp)) -list_del (&pos->cb_list); +list_del (&pos->list); } } }
@@ -351,9 +339,8 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) } }/* remove all waiting requests */ -list_for_each_entry_safe (cb_pos, cb_next, - &dev->write_list.mei_cb.cb_list, cb_list) { -list_del (&cb_pos->cb_list); +list_for_each_entry_safe (cb_pos, cb_next, &dev->write_list.list, list) { +list_del (&cb_pos->list);mei_free_cb_private (cb_pos); } }
@@ -685,7 +672,7 @@ int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl)if (!cb)return -ENOMEM ; -INIT_LIST_HEAD (&cb->cb_list); +mei_io_list_init (cb); cb->file_private = cl; cb->major_file_operations =MEI_CLOSE ;if (dev->mei_host_buffer_is_empty) {
@@ -696,11 +683,11 @@ int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl) goto free; }mdelay (10 );/* Wait for hardware disconnection ready */ -list_add_tail (&cb->cb_list, &dev->ctrl_rd_list.mei_cb.cb_list); +list_add_tail (&cb->list, &dev->ctrl_rd_list.list); }else {dev_dbg (&dev->pdev->dev,"add disconnect cb to control write list\n" ); -list_add_tail (&cb->cb_list, - &dev->ctrl_wr_list.mei_cb.cb_list); +list_add_tail (&cb->list, &dev->ctrl_wr_list.list); + }mutex_unlock (&dev->device_lock);
drivers/misc/mei/interrupt.c +58 -76
396 lines not on this page · raw message
drivers/misc/mei/iorw.c +14 -20
@@ -104,7 +104,7 @@ int mei_ioctl_connect_client(struct file *file, rets = -ENOMEM ; goto end; } -INIT_LIST_HEAD (&cb->cb_list); +mei_io_list_init (cb); cb->major_file_operations =MEI_IOCTL ;
@@ -193,9 +193,7 @@ int mei_ioctl_connect_client(struct file *file,dev_dbg (&dev->pdev->dev,"Sending connect message - succeeded\n" ); cl->timer_count =MEI_CONNECT_TIMEOUT ; cb->file_private = cl; -list_add_tail (&cb->cb_list, - &dev->ctrl_rd_list.mei_cb. - cb_list); +list_add_tail (&cb->list, &dev->ctrl_rd_list.list); }
@@ -203,8 +201,7 @@ int mei_ioctl_connect_client(struct file *file,dev_dbg (&dev->pdev->dev,"Queuing the connect request due to device busy\n" ); cb->file_private = cl;dev_dbg (&dev->pdev->dev,"add connect cb to control write list.\n" ); -list_add_tail (&cb->cb_list, - &dev->ctrl_wr_list.mei_cb.cb_list); +list_add_tail (&cb->list, &dev->ctrl_wr_list.list); }mutex_unlock (&dev->device_lock); err = wait_event_timeout(dev->wait_recvd_msg,
@@ -255,7 +252,7 @@ struct mei_cl_cb *find_amthi_read_list_entry(struct mei_cl_cb *next =NULL ;list_for_each_entry_safe (pos, next, - &dev->amthi_read_complete_list.mei_cb.cb_list, cb_list) { + &dev->amthi_read_complete_list.list, list) { cl_temp = (struct mei_cl *)pos->file_private;if (cl_temp && cl_temp == &dev->iamthif_cl && pos->file_object == file)
@@ -340,17 +337,17 @@ int amthi_read(struct mei_device *dev, struct file *file,if (time_after (jiffies, timeout)) {dev_dbg (&dev->pdev->dev,"amthi Time out\n" );/* 15 sec for the message has expired */ -list_del (&cb->cb_list); +list_del (&cb->list); rets = -ETIMEDOUT ; goto free; } }/* if the whole message will fit remove it from the list */ if (cb->buf_idx >= *offset && length >= (cb->buf_idx - *offset)) -list_del (&cb->cb_list); +list_del (&cb->list);else if (cb->buf_idx >0 && cb->buf_idx <= *offset) {/* end of the message has been reached */ -list_del (&cb->cb_list); +list_del (&cb->list); rets =0 ; goto free; }
@@ -441,9 +438,9 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl) rets = -ENODEV ; goto unlock; } -list_add_tail (&cb->cb_list, &dev->read_list.mei_cb.cb_list); +list_add_tail (&cb->list, &dev->read_list.list); }else { -list_add_tail (&cb->cb_list, &dev->ctrl_wr_list.mei_cb.cb_list); +list_add_tail (&cb->list, &dev->ctrl_wr_list.list); }return rets; unlock:
@@ -510,13 +507,11 @@ int amthi_write(struct mei_device *dev, struct mei_cl_cb *cb)dev_dbg (&dev->pdev->dev,"add amthi cb to write waiting list\n" ); dev->iamthif_current_cb = cb; dev->iamthif_file_object = cb->file_object; -list_add_tail (&cb->cb_list, - &dev->write_waiting_list.mei_cb.cb_list); +list_add_tail (&cb->list, &dev->write_waiting_list.list); }else {dev_dbg (&dev->pdev->dev,"message does not complete, " "so add amthi cb to write list.\n" ); -list_add_tail (&cb->cb_list, - &dev->write_list.mei_cb.cb_list); +list_add_tail (&cb->list, &dev->write_list.list); } }else {if (!(dev->mei_host_buffer_is_empty))
@@ -524,7 +519,7 @@ int amthi_write(struct mei_device *dev, struct mei_cl_cb *cb)dev_dbg (&dev->pdev->dev,"No flow control credentials, " "so add iamthif cb to write list.\n" ); -list_add_tail (&cb->cb_list, &dev->write_list.mei_cb.cb_list); +list_add_tail (&cb->list, &dev->write_list.list); }return 0 ; }
@@ -556,9 +551,8 @@ void mei_run_next_iamthif_cmd(struct mei_device *dev)dev_dbg (&dev->pdev->dev,"complete amthi cmd_list cb.\n" ); -list_for_each_entry_safe (pos, next, - &dev->amthi_cmd_list.mei_cb.cb_list, cb_list) { -list_del (&pos->cb_list); +list_for_each_entry_safe (pos, next, &dev->amthi_cmd_list.list, list) { +list_del (&pos->list); cl_tmp = (struct mei_cl *)pos->file_private;if (cl_tmp && cl_tmp == &dev->iamthif_cl) {
drivers/misc/mei/main.c +19 -24
126 lines not on this page · raw message
drivers/misc/mei/mei_dev.h +18 -14
@@ -144,7 +144,7 @@ struct mei_message_data {struct mei_cl_cb { -struct list_head cb_list; +struct list_head list;enum mei_cb_major_types major_file_operations;void *file_private;struct mei_message_data request_buffer;
@@ -175,10 +175,6 @@ struct mei_cl {struct mei_cl_cb *read_cb; }; -struct mei_io_list { -struct mei_cl_cb mei_cb; -}; -/** * struct mei_deive - MEI private device struct * @hbuf_depth - depth of host(write) buffer
@@ -189,15 +185,15 @@ struct mei_device {* lists of queues */ /* array of pointers to aio lists */ -struct mei_io_list read_list;/* driver read queue */ -struct mei_io_list write_list;/* driver write queue */ -struct mei_io_list write_waiting_list;/* write waiting queue */ -struct mei_io_list ctrl_wr_list;/* managed write IOCTL list */ -struct mei_io_list ctrl_rd_list;/* managed read IOCTL list */ -struct mei_io_list amthi_cmd_list;/* amthi list for cmd waiting */ +struct mei_cl_cb read_list;/* driver read queue */ +struct mei_cl_cb write_list;/* driver write queue */ +struct mei_cl_cb write_waiting_list;/* write waiting queue */ +struct mei_cl_cb ctrl_wr_list;/* managed write IOCTL list */ +struct mei_cl_cb ctrl_rd_list;/* managed read IOCTL list */ +struct mei_cl_cb amthi_cmd_list;/* amthi list for cmd waiting */ /* driver managed amthi list for reading completed amthi cmd data */ -struct mei_io_list amthi_read_complete_list; +struct mei_cl_cb amthi_read_complete_list;/* * list of files */
@@ -297,8 +293,16 @@ int mei_me_cl_by_id(struct mei_device *dev, u8 client_id);/* * MEI IO List Functions */ -void mei_io_list_init (struct mei_io_list *list); -void mei_io_list_flush (struct mei_io_list *list,struct mei_cl *cl); +/** +* mei_io_list_init - Sets up a queue list. +* +* @list: An instance cl callback structure +*/ +static inline void mei_io_list_init (struct mei_cl_cb *list) +{ +INIT_LIST_HEAD (&list->list); +} +void mei_io_list_flush (struct mei_cl_cb *list,struct mei_cl *cl);/* * MEI ME Client Functions
Signature · 1 line
1.7.4.4