diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2018-11-20 14:28:25 +0100 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2018-11-20 14:44:01 +0100 |
commit | 4585cd3bdfbf13808e56f227dede07a7d7e1dce0 (patch) | |
tree | e6354a2e97f97f93c41d3ceca4ec403cb47d9ade /target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch | |
parent | 4d0431801d447ee8cffe96289ee531c67b795c1c (diff) | |
download | upstream-4585cd3bdfbf13808e56f227dede07a7d7e1dce0.tar.gz upstream-4585cd3bdfbf13808e56f227dede07a7d7e1dce0.tar.bz2 upstream-4585cd3bdfbf13808e56f227dede07a7d7e1dce0.zip |
kernel: move diff adding run_parsers_by_type() between mtd patches
It makes more sense to add run_parsers_by_type() in a patch that
introduces parser types. That makes the other one just add a code using
it.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch')
-rw-r--r-- | target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch index 9dd1eaf04f..a48ae87ea2 100644 --- a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch @@ -20,7 +20,44 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> /* * Given a pointer to the MTD object in the mtd_part structure, we can retrieve -@@ -1118,6 +1122,61 @@ void mtd_part_parser_cleanup(struct mtd_ +@@ -741,6 +745,36 @@ int mtd_del_partition(struct mtd_info *m + } + EXPORT_SYMBOL_GPL(mtd_del_partition); + ++static int ++run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) ++{ ++ struct mtd_partition *parts; ++ int nr_parts; ++ int i; ++ ++ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts, ++ NULL); ++ if (nr_parts <= 0) ++ return nr_parts; ++ ++ if (WARN_ON(!parts)) ++ return 0; ++ ++ for (i = 0; i < nr_parts; i++) { ++ /* adjust partition offsets */ ++ parts[i].offset += slave->offset; ++ ++ mtd_add_partition(slave->parent, ++ parts[i].name, ++ parts[i].offset, ++ parts[i].size); ++ } ++ ++ kfree(parts); ++ ++ return nr_parts; ++} ++ + #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME + #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME + #else +@@ -1118,6 +1152,61 @@ void mtd_part_parser_cleanup(struct mtd_ } } |