aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2013-12-16 04:56:46 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-12-16 08:38:03 -0500
commitd5b877ffb9aa04a6fb6b6eae6dc19ca163d568a8 (patch)
treeeedc56fb461873c5697fe450f60e0497316ef670 /drivers/s390/cio
parent00381eeb47ef6b3b70d2a17c89a8205b6f1aa00a (diff)
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: 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/ccwgroup.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 959135a01847..fd3367a1dc7a 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -128,14 +128,14 @@ static ssize_t ccwgroup_online_store(struct device *dev,
128 const char *buf, size_t count) 128 const char *buf, size_t count)
129{ 129{
130 struct ccwgroup_device *gdev = to_ccwgroupdev(dev); 130 struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
131 struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver);
132 unsigned long value; 131 unsigned long value;
133 int ret; 132 int ret;
134 133
135 if (!dev->driver) 134 device_lock(dev);
136 return -EINVAL; 135 if (!dev->driver) {
137 if (!try_module_get(gdrv->driver.owner)) 136 ret = -EINVAL;
138 return -EINVAL; 137 goto out;
138 }
139 139
140 ret = kstrtoul(buf, 0, &value); 140 ret = kstrtoul(buf, 0, &value);
141 if (ret) 141 if (ret)
@@ -148,7 +148,7 @@ static ssize_t ccwgroup_online_store(struct device *dev,
148 else 148 else
149 ret = -EINVAL; 149 ret = -EINVAL;
150out: 150out:
151 module_put(gdrv->driver.owner); 151 device_unlock(dev);
152 return (ret == 0) ? count : ret; 152 return (ret == 0) ? count : ret;
153} 153}
154 154