mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-07 14:24:18 +08:00
staging: zram: simplify num_devices paramater
Simplify dealing with num_devices when initializing zram. Also cleanup some of the output messages. Signed-off-by: Davidlohr Bueso <davidlohr.bueso@hp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
955e7da82d
commit
ca3d70bd68
@ -40,7 +40,7 @@ static int zram_major;
|
|||||||
struct zram *zram_devices;
|
struct zram *zram_devices;
|
||||||
|
|
||||||
/* Module params (documentation at end) */
|
/* Module params (documentation at end) */
|
||||||
static unsigned int num_devices;
|
static unsigned int num_devices = 1;
|
||||||
|
|
||||||
static void zram_stat_inc(u32 *v)
|
static void zram_stat_inc(u32 *v)
|
||||||
{
|
{
|
||||||
@ -715,13 +715,7 @@ static int __init zram_init(void)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!num_devices) {
|
|
||||||
pr_info("num_devices not specified. Using default: 1\n");
|
|
||||||
num_devices = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate the device array and initialize each one */
|
/* 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);
|
zram_devices = kzalloc(num_devices * sizeof(struct zram), GFP_KERNEL);
|
||||||
if (!zram_devices) {
|
if (!zram_devices) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
@ -734,6 +728,8 @@ static int __init zram_init(void)
|
|||||||
goto free_devices;
|
goto free_devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pr_info("Created %u device(s) ...\n", num_devices);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
free_devices:
|
free_devices:
|
||||||
|
Loading…
Reference in New Issue
Block a user