diff options
-rw-r--r-- | drivers/s390/cio/device.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 868f8c6b053..e47aa3f0476 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -515,7 +515,11 @@ static ssize_t online_store (struct device *dev, struct device_attribute *attr, int force, ret; unsigned long i; - if (atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0) + if ((cdev->private->state != DEV_STATE_OFFLINE && + cdev->private->state != DEV_STATE_ONLINE && + cdev->private->state != DEV_STATE_BOXED && + cdev->private->state != DEV_STATE_DISCONNECTED) || + atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0) return -EAGAIN; if (cdev->drv && !try_module_get(cdev->drv->owner)) { |