Commit d5b877ff authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/cio: use device_lock to synchronize calls to the ccwgroup driver

When calling set_{on,off}line of a ccwgroup 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: default avatarPeter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 00381eeb
...@@ -128,14 +128,14 @@ static ssize_t ccwgroup_online_store(struct device *dev, ...@@ -128,14 +128,14 @@ static ssize_t ccwgroup_online_store(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct ccwgroup_device *gdev = to_ccwgroupdev(dev); struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver);
unsigned long value; unsigned long value;
int ret; int ret;
if (!dev->driver) device_lock(dev);
return -EINVAL; if (!dev->driver) {
if (!try_module_get(gdrv->driver.owner)) ret = -EINVAL;
return -EINVAL; goto out;
}
ret = kstrtoul(buf, 0, &value); ret = kstrtoul(buf, 0, &value);
if (ret) if (ret)
...@@ -148,7 +148,7 @@ static ssize_t ccwgroup_online_store(struct device *dev, ...@@ -148,7 +148,7 @@ static ssize_t ccwgroup_online_store(struct device *dev,
else else
ret = -EINVAL; ret = -EINVAL;
out: out:
module_put(gdrv->driver.owner); device_unlock(dev);
return (ret == 0) ? count : ret; return (ret == 0) ? count : ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment