|
@@ -20,44 +20,35 @@ Signed-off-by: Gabor Juhos <[email protected]>
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* Given a pointer to the MTD object in the mtd_part structure, we can retrieve
|
|
* Given a pointer to the MTD object in the mtd_part structure, we can retrieve
|
|
|
-@@ -762,6 +766,36 @@ int mtd_del_partition(struct mtd_info *m
|
|
|
|
|
|
|
+@@ -762,6 +766,27 @@ int mtd_del_partition(struct mtd_info *m
|
|
|
}
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(mtd_del_partition);
|
|
EXPORT_SYMBOL_GPL(mtd_del_partition);
|
|
|
|
|
|
|
|
+static int
|
|
+static int
|
|
|
+run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type)
|
|
+run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type)
|
|
|
+{
|
|
+{
|
|
|
-+ struct mtd_partition *parts;
|
|
|
|
|
-+ int nr_parts;
|
|
|
|
|
-+ int i;
|
|
|
|
|
|
|
++ struct mtd_partitions pparts = { };
|
|
|
|
|
++ int err;
|
|
|
+
|
|
+
|
|
|
-+ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts,
|
|
|
|
|
-+ NULL);
|
|
|
|
|
-+ if (nr_parts <= 0)
|
|
|
|
|
-+ return nr_parts;
|
|
|
|
|
|
|
++ pparts.nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type,
|
|
|
|
|
++ &pparts.parts, NULL);
|
|
|
|
|
++ if (pparts.nr_parts <= 0)
|
|
|
|
|
++ return pparts.nr_parts;
|
|
|
+
|
|
+
|
|
|
-+ if (WARN_ON(!parts))
|
|
|
|
|
|
|
++ if (WARN_ON(!pparts.parts))
|
|
|
+ return 0;
|
|
+ return 0;
|
|
|
+
|
|
+
|
|
|
-+ for (i = 0; i < nr_parts; i++) {
|
|
|
|
|
-+ /* adjust partition offsets */
|
|
|
|
|
-+ parts[i].offset += slave->offset;
|
|
|
|
|
|
|
++ err = add_mtd_partitions(&slave->mtd, pparts.parts, pparts.nr_parts);
|
|
|
+
|
|
+
|
|
|
-+ mtd_add_partition(slave->parent,
|
|
|
|
|
-+ parts[i].name,
|
|
|
|
|
-+ parts[i].offset,
|
|
|
|
|
-+ parts[i].size);
|
|
|
|
|
-+ }
|
|
|
|
|
-+
|
|
|
|
|
-+ kfree(parts);
|
|
|
|
|
|
|
++ kfree(pparts.parts);
|
|
|
+
|
|
+
|
|
|
-+ return nr_parts;
|
|
|
|
|
|
|
++ return err ? err : pparts.nr_parts;
|
|
|
+}
|
|
+}
|
|
|
+
|
|
+
|
|
|
#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
|
|
#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
|
|
|
#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME
|
|
#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME
|
|
|
#else
|
|
#else
|
|
|
-@@ -1147,6 +1181,61 @@ void mtd_part_parser_cleanup(struct mtd_
|
|
|
|
|
|
|
+@@ -1147,6 +1172,61 @@ void mtd_part_parser_cleanup(struct mtd_
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|