diff options
author | Frank Blaschka <frank.blaschka@de.ibm.com> | 2009-11-12 16:46:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-13 23:46:59 -0500 |
commit | 1e1815be87e45ce512f998ab35e9554c25031f4d (patch) | |
tree | cdea8e94953577889386289d10b750426aade29c /drivers/s390/net | |
parent | b7c2aecc0747f5c86a1959bce6a7ce8170a556b0 (diff) |
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: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390/net')
-rw-r--r-- | drivers/s390/net/ctcm_main.c | 5 | ||||
-rw-r--r-- | drivers/s390/net/fsm.c | 1 | ||||
-rw-r--r-- | drivers/s390/net/fsm.h | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index db054ed1a8cc..ecac3b2e32d4 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c | |||
@@ -1720,6 +1720,11 @@ static int ctcm_pm_suspend(struct ccwgroup_device *gdev) | |||
1720 | return 0; | 1720 | return 0; |
1721 | netif_device_detach(priv->channel[READ]->netdev); | 1721 | netif_device_detach(priv->channel[READ]->netdev); |
1722 | ctcm_close(priv->channel[READ]->netdev); | 1722 | ctcm_close(priv->channel[READ]->netdev); |
1723 | if (!wait_event_timeout(priv->fsm->wait_q, | ||
1724 | fsm_getstate(priv->fsm) == DEV_STATE_STOPPED, CTCM_TIME_5_SEC)) { | ||
1725 | netif_device_attach(priv->channel[READ]->netdev); | ||
1726 | return -EBUSY; | ||
1727 | } | ||
1723 | ccw_device_set_offline(gdev->cdev[1]); | 1728 | ccw_device_set_offline(gdev->cdev[1]); |
1724 | ccw_device_set_offline(gdev->cdev[0]); | 1729 | ccw_device_set_offline(gdev->cdev[0]); |
1725 | return 0; | 1730 | return 0; |
diff --git a/drivers/s390/net/fsm.c b/drivers/s390/net/fsm.c index 2c1db8036b7c..cae48cbc5e96 100644 --- a/drivers/s390/net/fsm.c +++ b/drivers/s390/net/fsm.c | |||
@@ -27,6 +27,7 @@ init_fsm(char *name, const char **state_names, const char **event_names, int nr_ | |||
27 | return NULL; | 27 | return NULL; |
28 | } | 28 | } |
29 | strlcpy(this->name, name, sizeof(this->name)); | 29 | strlcpy(this->name, name, sizeof(this->name)); |
30 | init_waitqueue_head(&this->wait_q); | ||
30 | 31 | ||
31 | f = kzalloc(sizeof(fsm), order); | 32 | f = kzalloc(sizeof(fsm), order); |
32 | if (f == NULL) { | 33 | if (f == NULL) { |
diff --git a/drivers/s390/net/fsm.h b/drivers/s390/net/fsm.h index af679c10f1bd..1e8b235d95b5 100644 --- a/drivers/s390/net/fsm.h +++ b/drivers/s390/net/fsm.h | |||
@@ -66,6 +66,7 @@ typedef struct fsm_instance_t { | |||
66 | char name[16]; | 66 | char name[16]; |
67 | void *userdata; | 67 | void *userdata; |
68 | int userint; | 68 | int userint; |
69 | wait_queue_head_t wait_q; | ||
69 | #if FSM_DEBUG_HISTORY | 70 | #if FSM_DEBUG_HISTORY |
70 | int history_index; | 71 | int history_index; |
71 | int history_size; | 72 | int history_size; |
@@ -197,6 +198,7 @@ fsm_newstate(fsm_instance *fi, int newstate) | |||
197 | printk(KERN_DEBUG "fsm(%s): New state %s\n", fi->name, | 198 | printk(KERN_DEBUG "fsm(%s): New state %s\n", fi->name, |
198 | fi->f->state_names[newstate]); | 199 | fi->f->state_names[newstate]); |
199 | #endif | 200 | #endif |
201 | wake_up(&fi->wait_q); | ||
200 | } | 202 | } |
201 | 203 | ||
202 | /** | 204 | /** |