Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 281147
b: refs/heads/master
c: b7cd2d9
h: refs/heads/master
i:
  281145: ab7adc5
  281143: fd2983a
v: v3
  • Loading branch information
Tomas Winkler authored and Greg Kroah-Hartman committed Nov 27, 2011
1 parent 6161aec commit e839011
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 184 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c83720941f92dc7b74c9d2869023b7e1cfcf9b6d
refs/heads/master: b7cd2d9fdc0185e0f4fede78f2a040c5f7c5a179
31 changes: 12 additions & 19 deletions trunk/drivers/staging/mei/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,15 @@ void mei_io_list_init(struct mei_io_list *list)
*/
void mei_io_list_flush(struct mei_io_list *list, struct mei_cl *cl)
{
struct mei_cl_cb *cb_pos = NULL;
struct mei_cl_cb *cb_next = NULL;


if (list_empty(&list->mei_cb.cb_list))
return;
struct mei_cl_cb *pos = NULL;
struct mei_cl_cb *next = NULL;

list_for_each_entry_safe(cb_pos, cb_next,
&list->mei_cb.cb_list, cb_list) {
if (cb_pos) {
list_for_each_entry_safe(pos, next, &list->mei_cb.cb_list, cb_list) {
if (pos) {
struct mei_cl *cl_tmp;
cl_tmp = (struct mei_cl *)cb_pos->file_private;
cl_tmp = (struct mei_cl *)pos->file_private;
if (mei_cl_cmp_id(cl, cl_tmp))
list_del(&cb_pos->cb_list);
list_del(&pos->cb_list);
}
}
}
Expand Down Expand Up @@ -335,14 +330,12 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
}
}
/* remove all waiting requests */
if (!list_empty(&dev->write_list.mei_cb.cb_list)) {
list_for_each_entry_safe(cb_pos, cb_next,
&dev->write_list.mei_cb.cb_list, cb_list) {
if (cb_pos) {
list_del(&cb_pos->cb_list);
mei_free_cb_private(cb_pos);
cb_pos = NULL;
}
list_for_each_entry_safe(cb_pos, cb_next,
&dev->write_list.mei_cb.cb_list, cb_list) {
if (cb_pos) {
list_del(&cb_pos->cb_list);
mei_free_cb_private(cb_pos);
cb_pos = NULL;
}
}
}
Expand Down
227 changes: 105 additions & 122 deletions trunk/drivers/staging/mei/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,21 +412,20 @@ static void mei_client_connect_response(struct mei_device *dev,
dev->iamthif_state = MEI_IAMTHIF_IDLE;
return;
}
if (!list_empty(&dev->ctrl_rd_list.mei_cb.cb_list)) {
list_for_each_entry_safe(cb_pos, cb_next,
&dev->ctrl_rd_list.mei_cb.cb_list, cb_list) {
cl = (struct mei_cl *)cb_pos->file_private;
if (!cl) {
list_for_each_entry_safe(cb_pos, cb_next,
&dev->ctrl_rd_list.mei_cb.cb_list, cb_list) {

cl = (struct mei_cl *)cb_pos->file_private;
if (!cl) {
list_del(&cb_pos->cb_list);
return;
}
if (MEI_IOCTL == cb_pos->major_file_operations) {
if (is_treat_specially_client(cl, rs)) {
list_del(&cb_pos->cb_list);
return;
}
if (MEI_IOCTL == cb_pos->major_file_operations) {
if (is_treat_specially_client(cl, rs)) {
list_del(&cb_pos->cb_list);
cl->status = 0;
cl->timer_count = 0;
break;
}
cl->status = 0;
cl->timer_count = 0;
break;
}
}
}
Expand All @@ -453,28 +452,26 @@ static void mei_client_disconnect_response(struct mei_device *dev,
rs->host_addr,
rs->status);

if (!list_empty(&dev->ctrl_rd_list.mei_cb.cb_list)) {
list_for_each_entry_safe(cb_pos, cb_next,
&dev->ctrl_rd_list.mei_cb.cb_list, cb_list) {
cl = (struct mei_cl *)cb_pos->file_private;
list_for_each_entry_safe(cb_pos, cb_next,
&dev->ctrl_rd_list.mei_cb.cb_list, cb_list) {
cl = (struct mei_cl *)cb_pos->file_private;

if (!cl) {
list_del(&cb_pos->cb_list);
return;
}
if (!cl) {
list_del(&cb_pos->cb_list);
return;
}

dev_dbg(&dev->pdev->dev, "list_for_each_entry_safe in ctrl_rd_list.\n");
if (cl->host_client_id == rs->host_addr &&
cl->me_client_id == rs->me_addr) {
dev_dbg(&dev->pdev->dev, "list_for_each_entry_safe in ctrl_rd_list.\n");
if (cl->host_client_id == rs->host_addr &&
cl->me_client_id == rs->me_addr) {

list_del(&cb_pos->cb_list);
if (!rs->status)
cl->state = MEI_FILE_DISCONNECTED;
list_del(&cb_pos->cb_list);
if (!rs->status)
cl->state = MEI_FILE_DISCONNECTED;

cl->status = 0;
cl->timer_count = 0;
break;
}
cl->status = 0;
cl->timer_count = 0;
break;
}
}
}
Expand Down Expand Up @@ -1222,7 +1219,7 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,
{

struct mei_cl *cl;
struct mei_cl_cb *cb_pos = NULL, *cb_next = NULL;
struct mei_cl_cb *pos = NULL, *next = NULL;
struct mei_io_list *list;
int ret;

Expand All @@ -1235,36 +1232,31 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,
dev_dbg(&dev->pdev->dev, "complete all waiting for write cb.\n");

list = &dev->write_waiting_list;
if (!list_empty(&list->mei_cb.cb_list)) {
list_for_each_entry_safe(cb_pos, cb_next,
&list->mei_cb.cb_list, cb_list) {
cl = (struct mei_cl *)cb_pos->file_private;
if (cl) {
cl->status = 0;
list_del(&cb_pos->cb_list);
if (MEI_WRITING == cl->writing_state &&
(cb_pos->major_file_operations ==
MEI_WRITE) &&
(cl != &dev->iamthif_cl)) {
dev_dbg(&dev->pdev->dev,
"MEI WRITE COMPLETE\n");
cl->writing_state =
MEI_WRITE_COMPLETE;
list_add_tail(&cb_pos->cb_list,
&cmpl_list->mei_cb.cb_list);
}
if (cl == &dev->iamthif_cl) {
dev_dbg(&dev->pdev->dev, "check iamthif flow control.\n");
if (dev->iamthif_flow_control_pending) {
ret =
_mei_irq_thread_iamthif_read(
dev, slots);
if (ret)
return ret;
}
}
list_for_each_entry_safe(pos, next,
&list->mei_cb.cb_list, cb_list) {
cl = (struct mei_cl *)pos->file_private;
if (cl == NULL)
continue;

cl->status = 0;
list_del(&pos->cb_list);
if (MEI_WRITING == cl->writing_state &&
(pos->major_file_operations == MEI_WRITE) &&
(cl != &dev->iamthif_cl)) {
dev_dbg(&dev->pdev->dev,
"MEI WRITE COMPLETE\n");
cl->writing_state = MEI_WRITE_COMPLETE;
list_add_tail(&pos->cb_list,
&cmpl_list->mei_cb.cb_list);
}
if (cl == &dev->iamthif_cl) {
dev_dbg(&dev->pdev->dev, "check iamthif flow control.\n");
if (dev->iamthif_flow_control_pending) {
ret = _mei_irq_thread_iamthif_read(
dev, slots);
if (ret)
return ret;
}

}
}

Expand Down Expand Up @@ -1312,24 +1304,24 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,

/* complete control write list CB */
dev_dbg(&dev->pdev->dev, "complete control write list cb.\n");
list_for_each_entry_safe(cb_pos, cb_next,
list_for_each_entry_safe(pos, next,
&dev->ctrl_wr_list.mei_cb.cb_list, cb_list) {
cl = (struct mei_cl *) cb_pos->file_private;
cl = (struct mei_cl *) pos->file_private;
if (!cl) {
list_del(&cb_pos->cb_list);
list_del(&pos->cb_list);
return -ENODEV;
}
switch (cb_pos->major_file_operations) {
switch (pos->major_file_operations) {
case MEI_CLOSE:
/* send disconnect message */
ret = _mei_irq_thread_close(dev, slots, cb_pos, cl, cmpl_list);
ret = _mei_irq_thread_close(dev, slots, pos, cl, cmpl_list);
if (ret)
return ret;

break;
case MEI_READ:
/* send flow control message */
ret = _mei_irq_thread_read(dev, slots, cb_pos, cl, cmpl_list);
ret = _mei_irq_thread_read(dev, slots, pos, cl, cmpl_list);
if (ret)
return ret;

Expand All @@ -1338,7 +1330,7 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,
/* connect message */
if (!mei_other_client_is_connecting(dev, cl))
continue;
ret = _mei_irq_thread_ioctl(dev, slots, cb_pos, cl, cmpl_list);
ret = _mei_irq_thread_ioctl(dev, slots, pos, cl, cmpl_list);
if (ret)
return ret;

Expand All @@ -1350,53 +1342,49 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,

}
/* complete write list CB */
if (!list_empty(&dev->write_list.mei_cb.cb_list)) {
dev_dbg(&dev->pdev->dev, "complete write list cb.\n");
list_for_each_entry_safe(cb_pos, cb_next,
&dev->write_list.mei_cb.cb_list, cb_list) {
cl = (struct mei_cl *)cb_pos->file_private;

if (cl) {
if (cl != &dev->iamthif_cl) {
if (!mei_flow_ctrl_creds(dev,
cl)) {
dev_dbg(&dev->pdev->dev,
"No flow control"
" credentials for client"
" %d, not sending.\n",
cl->host_client_id);
continue;
}
ret = _mei_irq_thread_cmpl(dev, slots,
cb_pos,
cl, cmpl_list);
if (ret)
return ret;

} else if (cl == &dev->iamthif_cl) {
/* IAMTHIF IOCTL */
dev_dbg(&dev->pdev->dev, "complete amthi write cb.\n");
if (!mei_flow_ctrl_creds(dev,
cl)) {
dev_dbg(&dev->pdev->dev,
"No flow control"
" credentials for amthi"
" client %d.\n",
cl->host_client_id);
continue;
}
ret = _mei_irq_thread_cmpl_iamthif(dev,
slots,
cb_pos,
cl,
cmpl_list);
if (ret)
return ret;
dev_dbg(&dev->pdev->dev, "complete write list cb.\n");
list_for_each_entry_safe(pos, next,
&dev->write_list.mei_cb.cb_list, cb_list) {
cl = (struct mei_cl *)pos->file_private;
if (cl == NULL)
continue;

if (cl != &dev->iamthif_cl) {
if (!mei_flow_ctrl_creds(dev, cl)) {
dev_dbg(&dev->pdev->dev,
"No flow control"
" credentials for client"
" %d, not sending.\n",
cl->host_client_id);
continue;
}
ret = _mei_irq_thread_cmpl(dev, slots,
pos,
cl, cmpl_list);
if (ret)
return ret;

}
} else if (cl == &dev->iamthif_cl) {
/* IAMTHIF IOCTL */
dev_dbg(&dev->pdev->dev, "complete amthi write cb.\n");
if (!mei_flow_ctrl_creds(dev, cl)) {
dev_dbg(&dev->pdev->dev,
"No flow control"
" credentials for amthi"
" client %d.\n",
cl->host_client_id);
continue;
}
ret = _mei_irq_thread_cmpl_iamthif(dev,
slots,
pos,
cl,
cmpl_list);
if (ret)
return ret;

}

}
return 0;
}
Expand Down Expand Up @@ -1487,18 +1475,13 @@ void mei_timer(struct work_struct *work)
amthi_complete_list = &dev->amthi_read_complete_list.
mei_cb.cb_list;

if (!list_empty(amthi_complete_list)) {
list_for_each_entry_safe(cb_pos, cb_next, amthi_complete_list, cb_list) {

list_for_each_entry_safe(cb_pos, cb_next,
amthi_complete_list,
cb_list) {
cl_pos = cb_pos->file_object->private_data;

cl_pos = cb_pos->file_object->private_data;

/* Finding the AMTHI entry. */
if (cl_pos == &dev->iamthif_cl)
list_del(&cb_pos->cb_list);
}
/* Finding the AMTHI entry. */
if (cl_pos == &dev->iamthif_cl)
list_del(&cb_pos->cb_list);
}
if (dev->iamthif_current_cb)
mei_free_cb_private(dev->iamthif_current_cb);
Expand Down
Loading

0 comments on commit e839011

Please sign in to comment.