aboutsummaryrefslogtreecommitdiff
path: root/drivers/s390
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2009-03-31 19:16:06 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-03-31 19:17:06 +0200
commitb5cd99e6b002776c0e946f38292adbb0258b7983 (patch)
tree5ab63d9d5ee4e325b6221107873b1c32573682b0 /drivers/s390
parent47593bfa1056d306fde067b28dd8617009be4121 (diff)
[S390] cio: disallow online setting of device in transient state
Return -EAGAIN on writes to sysfs online attribute if the corresponding ccw device is in transient state. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/cio/device.c6
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)) {