[PATCH 14/46] mtd: nandsim: Add simulator id to MTD parition name
Daniel Walter
dwalter at sigma-star.at
Wed Aug 31 00:28:21 PDT 2016
From: Richard Weinberger <richard at nod.at>
...also don't use spaces in the name. It allows
UBI attach via MTD name to function correctly.
Signed-off-by: Richard Weinberger <richard at nod.at>
---
drivers/mtd/nand/nandsim.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index bef5afa..2e02089 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -732,9 +732,9 @@ static void free_device(struct nandsim *ns)
}
}
-static char __init *get_partition_name(int i)
+static char *get_partition_name(struct nandsim *ns, int i)
{
- return kasprintf(GFP_KERNEL, "NAND simulator partition %d", i);
+ return kasprintf(GFP_KERNEL, "nandsim%d_%d", ns->index, i);
}
/*
@@ -818,7 +818,7 @@ static int init_nandsim(struct mtd_info *mtd, struct nandsim_params *nsparam)
NS_ERR("bad partition size.\n");
return -EINVAL;
}
- ns->partitions[i].name = get_partition_name(i);
+ ns->partitions[i].name = get_partition_name(ns, i);
if (!ns->partitions[i].name) {
NS_ERR("unable to allocate memory.\n");
return -ENOMEM;
@@ -834,7 +834,7 @@ static int init_nandsim(struct mtd_info *mtd, struct nandsim_params *nsparam)
NS_ERR("too many partitions.\n");
return -EINVAL;
}
- ns->partitions[i].name = get_partition_name(i);
+ ns->partitions[i].name = get_partition_name(ns, i);
if (!ns->partitions[i].name) {
NS_ERR("unable to allocate memory.\n");
return -ENOMEM;
--
2.8.3
More information about the linux-mtd
mailing list