Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 355062
b: refs/heads/master
c: 074b4c0
h: refs/heads/master
v: v3
  • Loading branch information
Tomas Winkler authored and Greg Kroah-Hartman committed Feb 6, 2013
1 parent 348dfe6 commit 512b953
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 23 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: 330dd7da5ec80e2c49c66bf353d8b4fa4fb8f5a9
refs/heads/master: 074b4c01abb68c6767612a01f41e9b4ed93d5fb8
51 changes: 51 additions & 0 deletions trunk/drivers/misc/mei/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,3 +676,54 @@ int mei_cl_read_start(struct mei_cl *cl)
return rets;
}

/**
* mei_cl_all_disconnect - disconnect forcefully all connected clients
*
* @dev - mei device
*/

void mei_cl_all_disconnect(struct mei_device *dev)
{
struct mei_cl *cl, *next;

list_for_each_entry_safe(cl, next, &dev->file_list, link) {
cl->state = MEI_FILE_DISCONNECTED;
cl->mei_flow_ctrl_creds = 0;
cl->read_cb = NULL;
cl->timer_count = 0;
}
}


/**
* mei_cl_all_read_wakeup - wake up all readings so they can be interrupted
*
* @dev - mei device
*/
void mei_cl_all_read_wakeup(struct mei_device *dev)
{
struct mei_cl *cl, *next;
list_for_each_entry_safe(cl, next, &dev->file_list, link) {
if (waitqueue_active(&cl->rx_wait)) {
dev_dbg(&dev->pdev->dev, "Waking up client!\n");
wake_up_interruptible(&cl->rx_wait);
}
}
}

/**
* mei_cl_all_write_clear - clear all pending writes
* @dev - mei device
*/
void mei_cl_all_write_clear(struct mei_device *dev)
{
struct mei_cl_cb *cb, *next;

list_for_each_entry_safe(cb, next, &dev->write_list.list, list) {
list_del(&cb->list);
mei_io_cb_free(cb);
}
}


5 changes: 5 additions & 0 deletions trunk/drivers/misc/mei/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,9 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file);
void mei_host_client_init(struct work_struct *work);


void mei_cl_all_disconnect(struct mei_device *dev);
void mei_cl_all_read_wakeup(struct mei_device *dev);
void mei_cl_all_write_clear(struct mei_device *dev);


#endif /* _MEI_CLIENT_H_ */
28 changes: 6 additions & 22 deletions trunk/drivers/misc/mei/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ int mei_hw_init(struct mei_device *dev)
*/
void mei_reset(struct mei_device *dev, int interrupts_enabled)
{
struct mei_cl *cl_pos = NULL;
struct mei_cl *cl_next = NULL;
struct mei_cl_cb *cb_pos = NULL;
struct mei_cl_cb *cb_next = NULL;
bool unexpected;

if (dev->dev_state == MEI_DEV_RECOVERING_FROM_RESET)
Expand All @@ -157,13 +153,8 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
dev->dev_state != MEI_DEV_POWER_DOWN)
dev->dev_state = MEI_DEV_RESETING;

list_for_each_entry_safe(cl_pos,
cl_next, &dev->file_list, link) {
cl_pos->state = MEI_FILE_DISCONNECTED;
cl_pos->mei_flow_ctrl_creds = 0;
cl_pos->read_cb = NULL;
cl_pos->timer_count = 0;
}
mei_cl_all_disconnect(dev);

/* remove entry if already in list */
dev_dbg(&dev->pdev->dev, "remove iamthif and wd from the file list.\n");
mei_cl_unlink(&dev->wd_cl);
Expand All @@ -185,18 +176,11 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
dev_warn(&dev->pdev->dev, "unexpected reset: dev_state = %s\n",
mei_dev_state_str(dev->dev_state));

/* Wake up all readings so they can be interrupted */
list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) {
if (waitqueue_active(&cl_pos->rx_wait)) {
dev_dbg(&dev->pdev->dev, "Waking up client!\n");
wake_up_interruptible(&cl_pos->rx_wait);
}
}
/* wake up all readings so they can be interrupted */
mei_cl_all_read_wakeup(dev);

/* remove all waiting requests */
list_for_each_entry_safe(cb_pos, cb_next, &dev->write_list.list, list) {
list_del(&cb_pos->list);
mei_io_cb_free(cb_pos);
}
mei_cl_all_write_clear(dev);
}


Expand Down

0 comments on commit 512b953

Please sign in to comment.