Commit 43801f6e authored by Noah Watkins's avatar Noah Watkins Committed by Greg Kroah-Hartman

staging: zram: make global var "devices" use unique name

The global variable "devices" is too general to be global.
This patch switches the name to be "zram_devices".
Signed-off-by: default avatarNoah Watkins <noahwatkins@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9ac4025d
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
/* Globals */ /* Globals */
static int zram_major; static int zram_major;
struct zram *devices; struct zram *zram_devices;
/* Module params (documentation at end) */ /* Module params (documentation at end) */
unsigned int num_devices; unsigned int num_devices;
...@@ -801,14 +801,14 @@ static int __init zram_init(void) ...@@ -801,14 +801,14 @@ static int __init zram_init(void)
/* Allocate the device array and initialize each one */ /* Allocate the device array and initialize each one */
pr_info("Creating %u devices ...\n", num_devices); pr_info("Creating %u devices ...\n", num_devices);
devices = kzalloc(num_devices * sizeof(struct zram), GFP_KERNEL); zram_devices = kzalloc(num_devices * sizeof(struct zram), GFP_KERNEL);
if (!devices) { if (!zram_devices) {
ret = -ENOMEM; ret = -ENOMEM;
goto unregister; goto unregister;
} }
for (dev_id = 0; dev_id < num_devices; dev_id++) { 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) if (ret)
goto free_devices; goto free_devices;
} }
...@@ -817,8 +817,8 @@ static int __init zram_init(void) ...@@ -817,8 +817,8 @@ static int __init zram_init(void)
free_devices: free_devices:
while (dev_id) while (dev_id)
destroy_device(&devices[--dev_id]); destroy_device(&zram_devices[--dev_id]);
kfree(devices); kfree(zram_devices);
unregister: unregister:
unregister_blkdev(zram_major, "zram"); unregister_blkdev(zram_major, "zram");
out: out:
...@@ -831,7 +831,7 @@ static void __exit zram_exit(void) ...@@ -831,7 +831,7 @@ static void __exit zram_exit(void)
struct zram *zram; struct zram *zram;
for (i = 0; i < num_devices; i++) { for (i = 0; i < num_devices; i++) {
zram = &devices[i]; zram = &zram_devices[i];
destroy_device(zram); destroy_device(zram);
if (zram->init_done) if (zram->init_done)
...@@ -840,7 +840,7 @@ static void __exit zram_exit(void) ...@@ -840,7 +840,7 @@ static void __exit zram_exit(void)
unregister_blkdev(zram_major, "zram"); unregister_blkdev(zram_major, "zram");
kfree(devices); kfree(zram_devices);
pr_debug("Cleanup done!\n"); pr_debug("Cleanup done!\n");
} }
......
...@@ -123,7 +123,7 @@ struct zram { ...@@ -123,7 +123,7 @@ struct zram {
struct zram_stats stats; struct zram_stats stats;
}; };
extern struct zram *devices; extern struct zram *zram_devices;
extern unsigned int num_devices; extern unsigned int num_devices;
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
extern struct attribute_group zram_disk_attr_group; extern struct attribute_group zram_disk_attr_group;
......
...@@ -35,7 +35,7 @@ static struct zram *dev_to_zram(struct device *dev) ...@@ -35,7 +35,7 @@ static struct zram *dev_to_zram(struct device *dev)
struct zram *zram = NULL; struct zram *zram = NULL;
for (i = 0; i < num_devices; i++) { for (i = 0; i < num_devices; i++) {
zram = &devices[i]; zram = &zram_devices[i];
if (disk_to_dev(zram->disk) == dev) if (disk_to_dev(zram->disk) == dev)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment