/* Globals */
static int zram_major;
-struct zram *devices;
+struct zram *zram_devices;
/* Module params (documentation at end) */
unsigned int num_devices;
/* 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;
}
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:
struct zram *zram;
for (i = 0; i < num_devices; i++) {
- zram = &devices[i];
+ zram = &zram_devices[i];
destroy_device(zram);
if (zram->init_done)
unregister_blkdev(zram_major, "zram");
- kfree(devices);
+ kfree(zram_devices);
pr_debug("Cleanup done!\n");
}
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;
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;
}