staging: zram: make global var "num_devices" use unique name
authorNoah Watkins <noahwatkins@gmail.com>
Wed, 20 Jul 2011 23:06:08 +0000 (17:06 -0600)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 23 Aug 2011 21:34:19 +0000 (14:34 -0700)
The global variable "num_devices" is too general to be
global. This patch switches the name to be "zram_num_devices".

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/zram/zram_drv.c
drivers/staging/zram/zram_drv.h
drivers/staging/zram/zram_sysfs.c

index 11e7e92ae726754150500d2dfe34f0c5f3650a2c..ec66b0a5873bae0088fe85aea22c1d12240141f5 100644 (file)
@@ -40,7 +40,7 @@ static int zram_major;
 struct zram *zram_devices;
 
 /* Module params (documentation at end) */
-unsigned int num_devices;
+unsigned int zram_num_devices;
 
 static void zram_stat_inc(u32 *v)
 {
@@ -780,9 +780,9 @@ static int __init zram_init(void)
 {
        int ret, dev_id;
 
-       if (num_devices > max_num_devices) {
+       if (zram_num_devices > max_num_devices) {
                pr_warning("Invalid value for num_devices: %u\n",
-                               num_devices);
+                               zram_num_devices);
                ret = -EINVAL;
                goto out;
        }
@@ -794,20 +794,20 @@ static int __init zram_init(void)
                goto out;
        }
 
-       if (!num_devices) {
+       if (!zram_num_devices) {
                pr_info("num_devices not specified. Using default: 1\n");
-               num_devices = 1;
+               zram_num_devices = 1;
        }
 
        /* Allocate the device array and initialize each one */
-       pr_info("Creating %u devices ...\n", num_devices);
-       zram_devices = kzalloc(num_devices * sizeof(struct zram), GFP_KERNEL);
+       pr_info("Creating %u devices ...\n", zram_num_devices);
+       zram_devices = kzalloc(zram_num_devices * sizeof(struct zram), GFP_KERNEL);
        if (!zram_devices) {
                ret = -ENOMEM;
                goto unregister;
        }
 
-       for (dev_id = 0; dev_id < num_devices; dev_id++) {
+       for (dev_id = 0; dev_id < zram_num_devices; dev_id++) {
                ret = create_device(&zram_devices[dev_id], dev_id);
                if (ret)
                        goto free_devices;
@@ -830,7 +830,7 @@ static void __exit zram_exit(void)
        int i;
        struct zram *zram;
 
-       for (i = 0; i < num_devices; i++) {
+       for (i = 0; i < zram_num_devices; i++) {
                zram = &zram_devices[i];
 
                destroy_device(zram);
@@ -844,8 +844,8 @@ static void __exit zram_exit(void)
        pr_debug("Cleanup done!\n");
 }
 
-module_param(num_devices, uint, 0);
-MODULE_PARM_DESC(num_devices, "Number of zram devices");
+module_param(zram_num_devices, uint, 0);
+MODULE_PARM_DESC(zram_num_devices, "Number of zram devices");
 
 module_init(zram_init);
 module_exit(zram_exit);
index 0e4b5409f9f7f177fca936eff2f975dc23dd02c9..59b01d602f44bef1f08ec18423602ffd40229836 100644 (file)
@@ -124,7 +124,7 @@ struct zram {
 };
 
 extern struct zram *zram_devices;
-extern unsigned int num_devices;
+extern unsigned int zram_num_devices;
 #ifdef CONFIG_SYSFS
 extern struct attribute_group zram_disk_attr_group;
 #endif
index 0f001e89eb511d045b4660b5d26d149216e1587f..df1f9dc4269cd86da40c252953e4b412e071889b 100644 (file)
@@ -34,7 +34,7 @@ static struct zram *dev_to_zram(struct device *dev)
        int i;
        struct zram *zram = NULL;
 
-       for (i = 0; i < num_devices; i++) {
+       for (i = 0; i < zram_num_devices; i++) {
                zram = &zram_devices[i];
                if (disk_to_dev(zram->disk) == dev)
                        break;