diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2013-12-16 10:54:13 +0100 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-12-16 14:38:02 +0100 |
commit | 00381eeb47ef6b3b70d2a17c89a8205b6f1aa00a (patch) | |
tree | a801b13badc66a26abae11f4ee48823e62f076e0 /drivers/s390/cio | |
parent | 74bd0d859dc3536b01c892abfa9f87620e4bca2f (diff) | |
download | linux-stable-00381eeb47ef6b3b70d2a17c89a8205b6f1aa00a.tar.gz linux-stable-00381eeb47ef6b3b70d2a17c89a8205b6f1aa00a.tar.bz2 linux-stable-00381eeb47ef6b3b70d2a17c89a8205b6f1aa00a.zip |
s390/cio: use device_lock to synchronize calls to the ccw driver
When calling set_{on,off}line of a ccw device driver we hold the
module reference of the owner. This is pretty useless - we don't
want to prevent module unloading but driver unbinding. Use the
driver core's device_lock instead.
Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio')
-rw-r--r-- | drivers/s390/cio/device.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 4a0734fcc83c..e9d783563cbb 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -549,17 +549,12 @@ static ssize_t online_store (struct device *dev, struct device_attribute *attr, if (!dev_fsm_final_state(cdev) && cdev->private->state != DEV_STATE_DISCONNECTED) { ret = -EAGAIN; - goto out_onoff; + goto out; } /* Prevent conflict between pending work and on-/offline processing.*/ if (work_pending(&cdev->private->todo_work)) { ret = -EAGAIN; - goto out_onoff; - } - - if (cdev->drv && !try_module_get(cdev->drv->driver.owner)) { - ret = -EINVAL; - goto out_onoff; + goto out; } if (!strncmp(buf, "force\n", count)) { force = 1; @@ -571,6 +566,8 @@ static ssize_t online_store (struct device *dev, struct device_attribute *attr, } if (ret) goto out; + + device_lock(dev); switch (i) { case 0: ret = online_store_handle_offline(cdev); @@ -581,10 +578,9 @@ static ssize_t online_store (struct device *dev, struct device_attribute *attr, default: ret = -EINVAL; } + device_unlock(dev); + out: - if (cdev->drv) - module_put(cdev->drv->driver.owner); -out_onoff: atomic_set(&cdev->private->onoff, 0); return (ret < 0) ? ret : count; } |