static ssize_t ccwgroup_online_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct ccwgroup_device *gdev; struct ccwgroup_driver *gdrv; unsigned long value; int ret; if (!dev->driver) return -ENODEV; gdev = to_ccwgroupdev(dev); gdrv = to_ccwgroupdrv(dev->driver); if (!try_module_get(gdrv->owner)) return -EINVAL; ret = strict_strtoul(buf, 0, &value); if (ret) goto out; if (value == 1) ret = ccwgroup_set_online(gdev); else if (value == 0) ret = ccwgroup_set_offline(gdev); else ret = -EINVAL; out: module_put(gdrv->owner); return (ret == 0) ? count : ret; }
static ssize_t ccwgroup_online_store (struct device *dev, const char *buf, size_t count) { struct ccwgroup_device *gdev; struct ccwgroup_driver *gdrv; unsigned int value; int ret; gdev = to_ccwgroupdev(dev); if (!dev->driver) return count; gdrv = to_ccwgroupdrv (gdev->dev.driver); if (!try_module_get(gdrv->owner)) return -EINVAL; value = simple_strtoul(buf, 0, 0); ret = count; if (value == 1) ccwgroup_set_online(gdev); else if (value == 0) ccwgroup_set_offline(gdev); else ret = -EINVAL; module_put(gdrv->owner); return ret; }
static ssize_t ccwgroup_online_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct ccwgroup_device *gdev = to_ccwgroupdev(dev); unsigned long value; int ret; device_lock(dev); if (!dev->driver) { ret = -EINVAL; goto out; } ret = kstrtoul(buf, 0, &value); if (ret) goto out; if (value == 1) ret = ccwgroup_set_online(gdev); else if (value == 0) ret = ccwgroup_set_offline(gdev); else ret = -EINVAL; out: device_unlock(dev); return (ret == 0) ? count : ret; }