From: Peter Oberparleiter Date: Mon, 7 Dec 2009 11:51:28 +0000 (+0100) Subject: [S390] cio: allow setting not-operational devices offline X-Git-Tag: MMI-PSA29.97-13-9~25715^2~57 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=350e91207bc9c6a464c22b9e0e30d21dfc07efe3;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [S390] cio: allow setting not-operational devices offline Accept a request for setting a not-operational device offline. This way, users can remove devices from Linux which would otherwise remain unusable until reboot. Signed-off-by: Peter Oberparleiter Signed-off-by: Martin Schwidefsky --- diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 6a9ac85065ed..9af864f615b0 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -529,11 +529,10 @@ static ssize_t online_store (struct device *dev, struct device_attribute *attr, int force, ret; unsigned long i; - 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) + if (!dev_fsm_final_state(cdev) && + cdev->private->state != DEV_STATE_DISCONNECTED) + return -EAGAIN; + if (atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0) return -EAGAIN; if (cdev->drv && !try_module_get(cdev->drv->owner)) {