From: Sebastian Ott Date: Mon, 16 Dec 2013 09:56:46 +0000 (+0100) Subject: s390/cio: use device_lock to synchronize calls to the ccwgroup driver X-Git-Tag: firefly_0821_release~176^2~4660^2~8 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d5b877ffb9aa04a6fb6b6eae6dc19ca163d568a8;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: Sebastian Ott Signed-off-by: Martin Schwidefsky --- 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, const char *buf, size_t count) { struct ccwgroup_device *gdev = to_ccwgroupdev(dev); - struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver); unsigned long value; int ret; - if (!dev->driver) - return -EINVAL; - if (!try_module_get(gdrv->driver.owner)) - return -EINVAL; + device_lock(dev); + if (!dev->driver) { + ret = -EINVAL; + goto out; + } ret = kstrtoul(buf, 0, &value); if (ret) @@ -148,7 +148,7 @@ static ssize_t ccwgroup_online_store(struct device *dev, else ret = -EINVAL; out: - module_put(gdrv->driver.owner); + device_unlock(dev); return (ret == 0) ? count : ret; }