Commit 1e1815be authored by Frank Blaschka's avatar Frank Blaschka Committed by David S. Miller

ctcm: suspend has to wait for outstanding I/O

State transition to DEV_STATE_STOPPED indicates all outstanding I/O has
finished. Add wait queue to wait for this state.
Signed-off-by: default avatarFrank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: default avatarUrsula Braun <ursula.braun@de.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b7c2aecc
...@@ -1720,6 +1720,11 @@ static int ctcm_pm_suspend(struct ccwgroup_device *gdev) ...@@ -1720,6 +1720,11 @@ static int ctcm_pm_suspend(struct ccwgroup_device *gdev)
return 0; return 0;
netif_device_detach(priv->channel[READ]->netdev); netif_device_detach(priv->channel[READ]->netdev);
ctcm_close(priv->channel[READ]->netdev); ctcm_close(priv->channel[READ]->netdev);
if (!wait_event_timeout(priv->fsm->wait_q,
fsm_getstate(priv->fsm) == DEV_STATE_STOPPED, CTCM_TIME_5_SEC)) {
netif_device_attach(priv->channel[READ]->netdev);
return -EBUSY;
}
ccw_device_set_offline(gdev->cdev[1]); ccw_device_set_offline(gdev->cdev[1]);
ccw_device_set_offline(gdev->cdev[0]); ccw_device_set_offline(gdev->cdev[0]);
return 0; return 0;
......
...@@ -27,6 +27,7 @@ init_fsm(char *name, const char **state_names, const char **event_names, int nr_ ...@@ -27,6 +27,7 @@ init_fsm(char *name, const char **state_names, const char **event_names, int nr_
return NULL; return NULL;
} }
strlcpy(this->name, name, sizeof(this->name)); strlcpy(this->name, name, sizeof(this->name));
init_waitqueue_head(&this->wait_q);
f = kzalloc(sizeof(fsm), order); f = kzalloc(sizeof(fsm), order);
if (f == NULL) { if (f == NULL) {
......
...@@ -66,6 +66,7 @@ typedef struct fsm_instance_t { ...@@ -66,6 +66,7 @@ typedef struct fsm_instance_t {
char name[16]; char name[16];
void *userdata; void *userdata;
int userint; int userint;
wait_queue_head_t wait_q;
#if FSM_DEBUG_HISTORY #if FSM_DEBUG_HISTORY
int history_index; int history_index;
int history_size; int history_size;
...@@ -197,6 +198,7 @@ fsm_newstate(fsm_instance *fi, int newstate) ...@@ -197,6 +198,7 @@ fsm_newstate(fsm_instance *fi, int newstate)
printk(KERN_DEBUG "fsm(%s): New state %s\n", fi->name, printk(KERN_DEBUG "fsm(%s): New state %s\n", fi->name,
fi->f->state_names[newstate]); fi->f->state_names[newstate]);
#endif #endif
wake_up(&fi->wait_q);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment