]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/staging/zram/zram_sysfs.c
Staging: zram: Remove need for explicit device initialization
[karo-tx-linux.git] / drivers / staging / zram / zram_sysfs.c
index b8dbaee8f1713e62791c5d748fe7651ad17ee2bd..6c574a994d11a23e2a0c0b4fc052769c8b0a9ccc 100644 (file)
@@ -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);