From 4585cd3bdfbf13808e56f227dede07a7d7e1dce0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 20 Nov 2018 14:28:25 +0100 Subject: [PATCH] kernel: move diff adding run_parsers_by_type() between mtd patches MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- ...for-different-partition-parser-types.patch | 39 +++++++++++++++++- ...arsers-for-rootfs-and-firmware-split.patch | 41 +------------------ ...for-different-partition-parser-types.patch | 39 +++++++++++++++++- ...arsers-for-rootfs-and-firmware-split.patch | 41 +------------------ 4 files changed, 80 insertions(+), 80 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 9dd1eaf04f0..a48ae87ea24 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 /* * 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_ } } diff --git a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index 0eeb4c7d013..3c105b2a47f 100644 --- a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -10,44 +10,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -745,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 -@@ -753,6 +783,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -783,6 +783,7 @@ run_parsers_by_type(struct mtd_part *sla static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -55,7 +18,7 @@ Signed-off-by: Gabor Juhos } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -767,6 +798,12 @@ static void mtd_partition_split(struct m +@@ -797,6 +798,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; diff --git a/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch index 15d76a7059a..0eb6d7422de 100644 --- a/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch @@ -20,7 +20,44 @@ Signed-off-by: Gabor Juhos /* * Given a pointer to the MTD object in the mtd_part structure, we can retrieve -@@ -1115,6 +1119,61 @@ void mtd_part_parser_cleanup(struct mtd_ +@@ -733,6 +737,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 +@@ -1115,6 +1149,61 @@ void mtd_part_parser_cleanup(struct mtd_ } } diff --git a/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index 293ed33c913..3cb27c7605d 100644 --- a/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -10,44 +10,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -737,6 +737,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 -@@ -745,6 +775,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -775,6 +775,7 @@ run_parsers_by_type(struct mtd_part *sla static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -55,7 +18,7 @@ Signed-off-by: Gabor Juhos } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -759,6 +790,12 @@ static void mtd_partition_split(struct m +@@ -789,6 +790,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; -- 2.30.2