diff options
Diffstat (limited to 'drivers/staging/zram/zram_sysfs.c')
-rw-r--r-- | drivers/staging/zram/zram_sysfs.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/drivers/staging/zram/zram_sysfs.c b/drivers/staging/zram/zram_sysfs.c index b8dbaee..6c574a9 100644 --- a/drivers/staging/zram/zram_sysfs.c +++ b/drivers/staging/zram/zram_sysfs.c @@ -58,8 +58,10 @@ static ssize_t disksize_store(struct device *dev, int ret; struct zram *zram = dev_to_zram(dev); - if (zram->init_done) + if (zram->init_done) { + pr_info("Cannot change disksize for initialized device\n"); return -EBUSY; + } ret = strict_strtoull(buf, 10, &zram->disksize); if (ret) @@ -79,25 +81,6 @@ static ssize_t initstate_show(struct device *dev, return sprintf(buf, "%u\n", zram->init_done); } -static ssize_t initstate_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) -{ - int ret; - unsigned long do_init; - struct zram *zram = dev_to_zram(dev); - - ret = strict_strtoul(buf, 10, &do_init); - if (ret) - return ret; - - if (!do_init) - return -EINVAL; - - zram_init_device(zram); - - return len; -} - static ssize_t reset_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -208,8 +191,7 @@ static ssize_t mem_used_total_show(struct device *dev, static DEVICE_ATTR(disksize, S_IRUGO | S_IWUGO, disksize_show, disksize_store); -static DEVICE_ATTR(initstate, S_IRUGO | S_IWUGO, - initstate_show, initstate_store); +static DEVICE_ATTR(initstate, S_IRUGO, initstate_show, NULL); static DEVICE_ATTR(reset, S_IWUGO, NULL, reset_store); static DEVICE_ATTR(num_reads, S_IRUGO, num_reads_show, NULL); static DEVICE_ATTR(num_writes, S_IRUGO, num_writes_show, NULL); |