staging: zram: make global var "devices" use unique name
authorNoah Watkins <noahwatkins@gmail.com>
Wed, 20 Jul 2011 23:05:57 +0000 (17:05 -0600)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 23 Aug 2011 21:34:19 +0000 (14:34 -0700)
The global variable "devices" is too general to be global.
This patch switches the name to be "zram_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 d70ec1ad10de05f20b6afa8fd6c82d67be0f727d..11e7e92ae726754150500d2dfe34f0c5f3650a2c 100644 (file)
@@ -37,7 +37,7 @@
 
 /* Globals */
 static int zram_major;
-struct zram *devices;
+struct zram *zram_devices;
 
 /* Module params (documentation at end) */
 unsigned int num_devices;
@@ -801,14 +801,14 @@ static int __init zram_init(void)
 
        /* Allocate the device array and initialize each one */
        pr_info("Creating %u devices ...\n", num_devices);
-       devices = kzalloc(num_devices * sizeof(struct zram), GFP_KERNEL);
-       if (!devices) {
+       zram_devices = kzalloc(num_devices * sizeof(struct zram), GFP_KERNEL);
+       if (!zram_devices) {
                ret = -ENOMEM;
                goto unregister;
        }
 
        for (dev_id = 0; dev_id < num_devices; dev_id++) {
-               ret = create_device(&devices[dev_id], dev_id);
+               ret = create_device(&zram_devices[dev_id], dev_id);
                if (ret)
                        goto free_devices;
        }
@@ -817,8 +817,8 @@ static int __init zram_init(void)
 
 free_devices:
        while (dev_id)
-               destroy_device(&devices[--dev_id]);
-       kfree(devices);
+               destroy_device(&zram_devices[--dev_id]);
+       kfree(zram_devices);
 unregister:
        unregister_blkdev(zram_major, "zram");
 out:
@@ -831,7 +831,7 @@ static void __exit zram_exit(void)
        struct zram *zram;
 
        for (i = 0; i < num_devices; i++) {
-               zram = &devices[i];
+               zram = &zram_devices[i];
 
                destroy_device(zram);
                if (zram->init_done)
@@ -840,7 +840,7 @@ static void __exit zram_exit(void)
 
        unregister_blkdev(zram_major, "zram");
 
-       kfree(devices);
+       kfree(zram_devices);
        pr_debug("Cleanup done!\n");
 }
 
index abe5221c100dc467df1405a7016ac5dccf906a14..0e4b5409f9f7f177fca936eff2f975dc23dd02c9 100644 (file)
@@ -123,7 +123,7 @@ struct zram {
        struct zram_stats stats;
 };
 
-extern struct zram *devices;
+extern struct zram *zram_devices;
 extern unsigned int num_devices;
 #ifdef CONFIG_SYSFS
 extern struct attribute_group zram_disk_attr_group;
index a70cc010d18da4d3eb0b620826595f394301dc01..0f001e89eb511d045b4660b5d26d149216e1587f 100644 (file)
@@ -35,7 +35,7 @@ static struct zram *dev_to_zram(struct device *dev)
        struct zram *zram = NULL;
 
        for (i = 0; i < num_devices; i++) {
-               zram = &devices[i];
+               zram = &zram_devices[i];
                if (disk_to_dev(zram->disk) == dev)
                        break;
        }