[openwrt/openwrt] kernel: backport mtd patch for minor partitioning cleanup

LEDE Commits lede-commits at lists.infradead.org
Sat May 12 14:57:06 PDT 2018


rmilecki pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/070693477a26a40fdf5de2316bc72073dc9930c1

commit 070693477a26a40fdf5de2316bc72073dc9930c1
Author: Rafał Miłecki <rafal at milecki.pl>
AuthorDate: Sat May 12 23:12:32 2018 +0200

    kernel: backport mtd patch for minor partitioning cleanup
    
    Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 ...de-adding-registering-partitions-to-the-p.patch | 168 +++++++++++++++++++++
 ...de-adding-registering-partitions-to-the-p.patch | 168 +++++++++++++++++++++
 ...t-add-generic-parsing-of-linux-part-probe.patch |   8 +-
 .../400-mtd-add-rootfs-split-support.patch         |   6 +-
 ...port-for-different-partition-parser-types.patch |   2 +-
 ...mtd-parsers-for-rootfs-and-firmware-split.patch |   6 +-
 .../404-mtd-add-more-helper-functions.patch        |   4 +-
 .../411-mtd-partial_eraseblock_write.patch         |   2 +-
 ...t-add-generic-parsing-of-linux-part-probe.patch |   8 +-
 .../400-mtd-add-rootfs-split-support.patch         |   6 +-
 ...port-for-different-partition-parser-types.patch |   2 +-
 ...mtd-parsers-for-rootfs-and-firmware-split.patch |   6 +-
 .../404-mtd-add-more-helper-functions.patch        |   4 +-
 .../411-mtd-partial_eraseblock_write.patch         |   2 +-
 14 files changed, 364 insertions(+), 28 deletions(-)

diff --git a/target/linux/generic/backport-4.14/042-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch b/target/linux/generic/backport-4.14/042-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch
new file mode 100644
index 0000000..8307743
--- /dev/null
+++ b/target/linux/generic/backport-4.14/042-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch
@@ -0,0 +1,168 @@
+From 5ac67ce36cfe38b4c104a42ce52c5c8d526f1c95 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Tue, 27 Mar 2018 22:35:41 +0200
+Subject: [PATCH] mtd: move code adding (registering) partitions to the
+ parse_mtd_partitions()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This commit slightly simplifies the code. Every parse_mtd_partitions()
+caller (out of two existing ones) had to add partitions & cleanup parser
+on its own. This moves that responsibility into the function.
+
+That change also allows dropping struct mtd_partitions argument.
+
+There is one minor behavior change caused by this cleanup. If
+parse_mtd_partitions() fails to add partitions (add_mtd_partitions()
+return an error) then mtd_device_parse_register() will still try to
+add (register) fallback partitions. It's a real corner case affecting
+one of uncommon error paths and shouldn't cause any harm.
+
+Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
+Signed-off-by: Boris Brezillon <boris.brezillon at bootlin.com>
+---
+ drivers/mtd/mtdcore.c | 14 ++++----------
+ drivers/mtd/mtdcore.h |  1 -
+ drivers/mtd/mtdpart.c | 44 ++++++++++++++++----------------------------
+ 3 files changed, 20 insertions(+), 39 deletions(-)
+
+--- a/drivers/mtd/mtdcore.c
++++ b/drivers/mtd/mtdcore.c
+@@ -686,7 +686,6 @@ int mtd_device_parse_register(struct mtd
+ 			      const struct mtd_partition *parts,
+ 			      int nr_parts)
+ {
+-	struct mtd_partitions parsed = { };
+ 	int ret;
+ 
+ 	mtd_set_dev_defaults(mtd);
+@@ -698,13 +697,10 @@ int mtd_device_parse_register(struct mtd
+ 	}
+ 
+ 	/* Prefer parsed partitions over driver-provided fallback */
+-	ret = parse_mtd_partitions(mtd, types, &parsed, parser_data);
+-	if (!ret && parsed.nr_parts) {
+-		parts = parsed.parts;
+-		nr_parts = parsed.nr_parts;
+-	}
+-
+-	if (nr_parts)
++	ret = parse_mtd_partitions(mtd, types, parser_data);
++	if (ret > 0)
++		ret = 0;
++	else if (nr_parts)
+ 		ret = add_mtd_partitions(mtd, parts, nr_parts);
+ 	else if (!device_is_registered(&mtd->dev))
+ 		ret = add_mtd_device(mtd);
+@@ -730,8 +726,6 @@ int mtd_device_parse_register(struct mtd
+ 	}
+ 
+ out:
+-	/* Cleanup any parsed partitions */
+-	mtd_part_parser_cleanup(&parsed);
+ 	if (ret && device_is_registered(&mtd->dev))
+ 		del_mtd_device(mtd);
+ 
+--- a/drivers/mtd/mtdcore.h
++++ b/drivers/mtd/mtdcore.h
+@@ -15,7 +15,6 @@ int del_mtd_partitions(struct mtd_info *
+ struct mtd_partitions;
+ 
+ int parse_mtd_partitions(struct mtd_info *master, const char * const *types,
+-			 struct mtd_partitions *pparts,
+ 			 struct mtd_part_parser_data *data);
+ 
+ void mtd_part_parser_cleanup(struct mtd_partitions *parts);
+--- a/drivers/mtd/mtdpart.c
++++ b/drivers/mtd/mtdpart.c
+@@ -383,20 +383,7 @@ static inline void free_partition(struct
+  */
+ static int mtd_parse_part(struct mtd_part *slave, const char *const *types)
+ {
+-	struct mtd_partitions parsed;
+-	int err;
+-
+-	err = parse_mtd_partitions(&slave->mtd, types, &parsed, NULL);
+-	if (err)
+-		return err;
+-	else if (!parsed.nr_parts)
+-		return -ENOENT;
+-
+-	err = add_mtd_partitions(&slave->mtd, parsed.parts, parsed.nr_parts);
+-
+-	mtd_part_parser_cleanup(&parsed);
+-
+-	return err;
++	return parse_mtd_partitions(&slave->mtd, types, NULL);
+ }
+ 
+ static struct mtd_part *allocate_partition(struct mtd_info *parent,
+@@ -981,30 +968,27 @@ static int mtd_part_of_parse(struct mtd_
+ }
+ 
+ /**
+- * parse_mtd_partitions - parse MTD partitions
++ * parse_mtd_partitions - parse and register MTD partitions
++ *
+  * @master: the master partition (describes whole MTD device)
+  * @types: names of partition parsers to try or %NULL
+- * @pparts: info about partitions found is returned here
+  * @data: MTD partition parser-specific data
+  *
+- * This function tries to find partition on MTD device @master. It uses MTD
+- * partition parsers, specified in @types. However, if @types is %NULL, then
+- * the default list of parsers is used. The default list contains only the
++ * This function tries to find & register partitions on MTD device @master. It
++ * uses MTD partition parsers, specified in @types. However, if @types is %NULL,
++ * then the default list of parsers is used. The default list contains only the
+  * "cmdlinepart" and "ofpart" parsers ATM.
+  * Note: If there are more then one parser in @types, the kernel only takes the
+  * partitions parsed out by the first parser.
+  *
+  * This function may return:
+  * o a negative error code in case of failure
+- * o zero otherwise, and @pparts will describe the partitions, number of
+- *   partitions, and the parser which parsed them. Caller must release
+- *   resources with mtd_part_parser_cleanup() when finished with the returned
+- *   data.
++ * o number of found partitions otherwise
+  */
+ int parse_mtd_partitions(struct mtd_info *master, const char *const *types,
+-			 struct mtd_partitions *pparts,
+ 			 struct mtd_part_parser_data *data)
+ {
++	struct mtd_partitions pparts = { };
+ 	struct mtd_part_parser *parser;
+ 	int ret, err = 0;
+ 
+@@ -1018,7 +1002,7 @@ int parse_mtd_partitions(struct mtd_info
+ 		 * handled in a separated function.
+ 		 */
+ 		if (!strcmp(*types, "ofpart")) {
+-			ret = mtd_part_of_parse(master, pparts);
++			ret = mtd_part_of_parse(master, &pparts);
+ 		} else {
+ 			pr_debug("%s: parsing partitions %s\n", master->name,
+ 				 *types);
+@@ -1029,13 +1013,17 @@ int parse_mtd_partitions(struct mtd_info
+ 				parser ? parser->name : NULL);
+ 			if (!parser)
+ 				continue;
+-			ret = mtd_part_do_parse(parser, master, pparts, data);
++			ret = mtd_part_do_parse(parser, master, &pparts, data);
+ 			if (ret <= 0)
+ 				mtd_part_parser_put(parser);
+ 		}
+ 		/* Found partitions! */
+-		if (ret > 0)
+-			return 0;
++		if (ret > 0) {
++			err = add_mtd_partitions(master, pparts.parts,
++						 pparts.nr_parts);
++			mtd_part_parser_cleanup(&pparts);
++			return err ? err : pparts.nr_parts;
++		}
+ 		/*
+ 		 * Stash the first error we see; only report it if no parser
+ 		 * succeeds
diff --git a/target/linux/generic/backport-4.9/068-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch b/target/linux/generic/backport-4.9/068-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch
new file mode 100644
index 0000000..29aa3b9
--- /dev/null
+++ b/target/linux/generic/backport-4.9/068-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch
@@ -0,0 +1,168 @@
+From 5ac67ce36cfe38b4c104a42ce52c5c8d526f1c95 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Tue, 27 Mar 2018 22:35:41 +0200
+Subject: [PATCH] mtd: move code adding (registering) partitions to the
+ parse_mtd_partitions()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This commit slightly simplifies the code. Every parse_mtd_partitions()
+caller (out of two existing ones) had to add partitions & cleanup parser
+on its own. This moves that responsibility into the function.
+
+That change also allows dropping struct mtd_partitions argument.
+
+There is one minor behavior change caused by this cleanup. If
+parse_mtd_partitions() fails to add partitions (add_mtd_partitions()
+return an error) then mtd_device_parse_register() will still try to
+add (register) fallback partitions. It's a real corner case affecting
+one of uncommon error paths and shouldn't cause any harm.
+
+Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
+Signed-off-by: Boris Brezillon <boris.brezillon at bootlin.com>
+---
+ drivers/mtd/mtdcore.c | 14 ++++----------
+ drivers/mtd/mtdcore.h |  1 -
+ drivers/mtd/mtdpart.c | 44 ++++++++++++++++----------------------------
+ 3 files changed, 20 insertions(+), 39 deletions(-)
+
+--- a/drivers/mtd/mtdcore.c
++++ b/drivers/mtd/mtdcore.c
+@@ -676,7 +676,6 @@ int mtd_device_parse_register(struct mtd
+ 			      const struct mtd_partition *parts,
+ 			      int nr_parts)
+ {
+-	struct mtd_partitions parsed = { };
+ 	int ret;
+ 
+ 	mtd_set_dev_defaults(mtd);
+@@ -688,13 +687,10 @@ int mtd_device_parse_register(struct mtd
+ 	}
+ 
+ 	/* Prefer parsed partitions over driver-provided fallback */
+-	ret = parse_mtd_partitions(mtd, types, &parsed, parser_data);
+-	if (!ret && parsed.nr_parts) {
+-		parts = parsed.parts;
+-		nr_parts = parsed.nr_parts;
+-	}
+-
+-	if (nr_parts)
++	ret = parse_mtd_partitions(mtd, types, parser_data);
++	if (ret > 0)
++		ret = 0;
++	else if (nr_parts)
+ 		ret = add_mtd_partitions(mtd, parts, nr_parts);
+ 	else if (!device_is_registered(&mtd->dev))
+ 		ret = add_mtd_device(mtd);
+@@ -720,8 +716,6 @@ int mtd_device_parse_register(struct mtd
+ 	}
+ 
+ out:
+-	/* Cleanup any parsed partitions */
+-	mtd_part_parser_cleanup(&parsed);
+ 	if (ret && device_is_registered(&mtd->dev))
+ 		del_mtd_device(mtd);
+ 
+--- a/drivers/mtd/mtdcore.h
++++ b/drivers/mtd/mtdcore.h
+@@ -14,7 +14,6 @@ int del_mtd_partitions(struct mtd_info *
+ struct mtd_partitions;
+ 
+ int parse_mtd_partitions(struct mtd_info *master, const char * const *types,
+-			 struct mtd_partitions *pparts,
+ 			 struct mtd_part_parser_data *data);
+ 
+ void mtd_part_parser_cleanup(struct mtd_partitions *parts);
+--- a/drivers/mtd/mtdpart.c
++++ b/drivers/mtd/mtdpart.c
+@@ -383,20 +383,7 @@ static inline void free_partition(struct
+  */
+ static int mtd_parse_part(struct mtd_part *slave, const char *const *types)
+ {
+-	struct mtd_partitions parsed;
+-	int err;
+-
+-	err = parse_mtd_partitions(&slave->mtd, types, &parsed, NULL);
+-	if (err)
+-		return err;
+-	else if (!parsed.nr_parts)
+-		return -ENOENT;
+-
+-	err = add_mtd_partitions(&slave->mtd, parsed.parts, parsed.nr_parts);
+-
+-	mtd_part_parser_cleanup(&parsed);
+-
+-	return err;
++	return parse_mtd_partitions(&slave->mtd, types, NULL);
+ }
+ 
+ static struct mtd_part *allocate_partition(struct mtd_info *parent,
+@@ -973,30 +960,27 @@ static int mtd_part_of_parse(struct mtd_
+ }
+ 
+ /**
+- * parse_mtd_partitions - parse MTD partitions
++ * parse_mtd_partitions - parse and register MTD partitions
++ *
+  * @master: the master partition (describes whole MTD device)
+  * @types: names of partition parsers to try or %NULL
+- * @pparts: info about partitions found is returned here
+  * @data: MTD partition parser-specific data
+  *
+- * This function tries to find partition on MTD device @master. It uses MTD
+- * partition parsers, specified in @types. However, if @types is %NULL, then
+- * the default list of parsers is used. The default list contains only the
++ * This function tries to find & register partitions on MTD device @master. It
++ * uses MTD partition parsers, specified in @types. However, if @types is %NULL,
++ * then the default list of parsers is used. The default list contains only the
+  * "cmdlinepart" and "ofpart" parsers ATM.
+  * Note: If there are more then one parser in @types, the kernel only takes the
+  * partitions parsed out by the first parser.
+  *
+  * This function may return:
+  * o a negative error code in case of failure
+- * o zero otherwise, and @pparts will describe the partitions, number of
+- *   partitions, and the parser which parsed them. Caller must release
+- *   resources with mtd_part_parser_cleanup() when finished with the returned
+- *   data.
++ * o number of found partitions otherwise
+  */
+ int parse_mtd_partitions(struct mtd_info *master, const char *const *types,
+-			 struct mtd_partitions *pparts,
+ 			 struct mtd_part_parser_data *data)
+ {
++	struct mtd_partitions pparts = { };
+ 	struct mtd_part_parser *parser;
+ 	int ret, err = 0;
+ 
+@@ -1010,7 +994,7 @@ int parse_mtd_partitions(struct mtd_info
+ 		 * handled in a separated function.
+ 		 */
+ 		if (!strcmp(*types, "ofpart")) {
+-			ret = mtd_part_of_parse(master, pparts);
++			ret = mtd_part_of_parse(master, &pparts);
+ 		} else {
+ 			pr_debug("%s: parsing partitions %s\n", master->name,
+ 				 *types);
+@@ -1021,13 +1005,17 @@ int parse_mtd_partitions(struct mtd_info
+ 				parser ? parser->name : NULL);
+ 			if (!parser)
+ 				continue;
+-			ret = mtd_part_do_parse(parser, master, pparts, data);
++			ret = mtd_part_do_parse(parser, master, &pparts, data);
+ 			if (ret <= 0)
+ 				mtd_part_parser_put(parser);
+ 		}
+ 		/* Found partitions! */
+-		if (ret > 0)
+-			return 0;
++		if (ret > 0) {
++			err = add_mtd_partitions(master, pparts.parts,
++						 pparts.nr_parts);
++			mtd_part_parser_cleanup(&pparts);
++			return err ? err : pparts.nr_parts;
++		}
+ 		/*
+ 		 * Stash the first error we see; only report it if no parser
+ 		 * succeeds
diff --git a/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch
index 6379ff3..0e858d9 100644
--- a/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch
+++ b/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch
@@ -104,7 +104,7 @@ Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
  #include <linux/err.h>
  #include <linux/of.h>
  
-@@ -864,6 +865,32 @@ void deregister_mtd_parser(struct mtd_pa
+@@ -851,6 +852,32 @@ void deregister_mtd_parser(struct mtd_pa
  EXPORT_SYMBOL_GPL(deregister_mtd_parser);
  
  /*
@@ -137,8 +137,8 @@ Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
   * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you
   * are changing this array!
   */
-@@ -1007,6 +1034,13 @@ int parse_mtd_partitions(struct mtd_info
- {
+@@ -991,6 +1018,13 @@ int parse_mtd_partitions(struct mtd_info
+ 	struct mtd_partitions pparts = { };
  	struct mtd_part_parser *parser;
  	int ret, err = 0;
 +	const char *const *types_of = NULL;
@@ -151,7 +151,7 @@ Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
  
  	if (!types)
  		types = default_mtd_part_types;
-@@ -1043,6 +1077,7 @@ int parse_mtd_partitions(struct mtd_info
+@@ -1031,6 +1065,7 @@ int parse_mtd_partitions(struct mtd_info
  		if (ret < 0 && !err)
  			err = ret;
  	}
diff --git a/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch
index e722d8c..bc2272d 100644
--- a/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch
+++ b/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch
@@ -60,7 +60,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  /*
   * Given a pointer to the MTD object in the mtd_part structure, we can retrieve
   * the pointer to that structure.
-@@ -687,6 +691,7 @@ int mtd_add_partition(struct mtd_info *p
+@@ -674,6 +678,7 @@ int mtd_add_partition(struct mtd_info *p
  	mutex_unlock(&mtd_partitions_mutex);
  
  	add_mtd_device(&new->mtd);
@@ -68,7 +68,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  
  	mtd_add_partition_attrs(new);
  
-@@ -765,6 +770,35 @@ int mtd_del_partition(struct mtd_info *m
+@@ -752,6 +757,35 @@ int mtd_del_partition(struct mtd_info *m
  }
  EXPORT_SYMBOL_GPL(mtd_del_partition);
  
@@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  /*
   * This function, given a master MTD object and a partition table, creates
   * and registers slave MTD objects which are bound to the master according to
-@@ -796,6 +830,7 @@ int add_mtd_partitions(struct mtd_info *
+@@ -783,6 +817,7 @@ int add_mtd_partitions(struct mtd_info *
  		mutex_unlock(&mtd_partitions_mutex);
  
  		add_mtd_device(&slave->mtd);
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 182d8d4..7cb336b 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
@@ -9,7 +9,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
 
 --- a/drivers/mtd/mtdpart.c
 +++ b/drivers/mtd/mtdpart.c
-@@ -1132,6 +1132,62 @@ void mtd_part_parser_cleanup(struct mtd_
+@@ -1120,6 +1120,62 @@ 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 26a19b8..cfd178e 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,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
 
 --- a/drivers/mtd/mtdpart.c
 +++ b/drivers/mtd/mtdpart.c
-@@ -770,6 +770,36 @@ int mtd_del_partition(struct mtd_info *m
+@@ -757,6 +757,36 @@ int mtd_del_partition(struct mtd_info *m
  }
  EXPORT_SYMBOL_GPL(mtd_del_partition);
  
@@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
  #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #define SPLIT_FIRMWARE_NAME	CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #else
-@@ -778,6 +808,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition);
+@@ -765,6 +795,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition);
  
  static void split_firmware(struct mtd_info *master, struct mtd_part *part)
  {
@@ -55,7 +55,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
  }
  
  void __weak arch_split_mtd_part(struct mtd_info *master, const char *name,
-@@ -792,6 +823,12 @@ static void mtd_partition_split(struct m
+@@ -779,6 +810,12 @@ static void mtd_partition_split(struct m
  	if (rootfs_found)
  		return;
  
diff --git a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
index 9b2fcac..98732e4 100644
--- a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
+++ b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
@@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
 
 --- a/drivers/mtd/mtdpart.c
 +++ b/drivers/mtd/mtdpart.c
-@@ -800,6 +800,17 @@ run_parsers_by_type(struct mtd_part *sla
+@@ -787,6 +787,17 @@ run_parsers_by_type(struct mtd_part *sla
  	return nr_parts;
  }
  
@@ -29,7 +29,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
  #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #define SPLIT_FIRMWARE_NAME	CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #else
-@@ -1242,6 +1253,24 @@ int mtd_is_partition(const struct mtd_in
+@@ -1230,6 +1241,24 @@ int mtd_is_partition(const struct mtd_in
  }
  EXPORT_SYMBOL_GPL(mtd_is_partition);
  
diff --git a/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch
index 9de5fd2..2fcaec5 100644
--- a/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch
+++ b/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch
@@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  
  		if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
  			instr->fail_addr -= part->offset;
-@@ -599,19 +668,22 @@ static struct mtd_part *allocate_partiti
+@@ -586,19 +655,22 @@ static struct mtd_part *allocate_partiti
  	remainder = do_div(tmp, wr_alignment);
  	if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) {
  		/* Doesn't start on a boundary of major erase size */
diff --git a/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch
index 5f0fa3a..e2a0e48 100644
--- a/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch
+++ b/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch
@@ -114,7 +114,7 @@ Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
  #include <linux/err.h>
  #include <linux/of.h>
  
-@@ -856,6 +857,42 @@ void deregister_mtd_parser(struct mtd_pa
+@@ -843,6 +844,42 @@ void deregister_mtd_parser(struct mtd_pa
  EXPORT_SYMBOL_GPL(deregister_mtd_parser);
  
  /*
@@ -157,8 +157,8 @@ Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
   * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you
   * are changing this array!
   */
-@@ -999,6 +1036,13 @@ int parse_mtd_partitions(struct mtd_info
- {
+@@ -983,6 +1020,13 @@ int parse_mtd_partitions(struct mtd_info
+ 	struct mtd_partitions pparts = { };
  	struct mtd_part_parser *parser;
  	int ret, err = 0;
 +	const char *const *types_of = NULL;
@@ -171,7 +171,7 @@ Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
  
  	if (!types)
  		types = default_mtd_part_types;
-@@ -1035,6 +1079,7 @@ int parse_mtd_partitions(struct mtd_info
+@@ -1023,6 +1067,7 @@ int parse_mtd_partitions(struct mtd_info
  		if (ret < 0 && !err)
  			err = ret;
  	}
diff --git a/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch
index ef7a6df..10be7a1 100644
--- a/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch
+++ b/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch
@@ -60,7 +60,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  /*
   * Given a pointer to the MTD object in the mtd_part structure, we can retrieve
   * the pointer to that structure.
-@@ -679,6 +683,7 @@ int mtd_add_partition(struct mtd_info *p
+@@ -666,6 +670,7 @@ int mtd_add_partition(struct mtd_info *p
  	mutex_unlock(&mtd_partitions_mutex);
  
  	add_mtd_device(&new->mtd);
@@ -68,7 +68,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  
  	mtd_add_partition_attrs(new);
  
-@@ -757,6 +762,35 @@ int mtd_del_partition(struct mtd_info *m
+@@ -744,6 +749,35 @@ int mtd_del_partition(struct mtd_info *m
  }
  EXPORT_SYMBOL_GPL(mtd_del_partition);
  
@@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  /*
   * This function, given a master MTD object and a partition table, creates
   * and registers slave MTD objects which are bound to the master according to
-@@ -788,6 +822,7 @@ int add_mtd_partitions(struct mtd_info *
+@@ -775,6 +809,7 @@ int add_mtd_partitions(struct mtd_info *
  		mutex_unlock(&mtd_partitions_mutex);
  
  		add_mtd_device(&slave->mtd);
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 54cfcb0..63affd7 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
@@ -9,7 +9,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
 
 --- a/drivers/mtd/mtdpart.c
 +++ b/drivers/mtd/mtdpart.c
-@@ -1134,6 +1134,62 @@ void mtd_part_parser_cleanup(struct mtd_
+@@ -1122,6 +1122,62 @@ 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 9b406d4..10d8551 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,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
 
 --- a/drivers/mtd/mtdpart.c
 +++ b/drivers/mtd/mtdpart.c
-@@ -762,6 +762,36 @@ int mtd_del_partition(struct mtd_info *m
+@@ -749,6 +749,36 @@ int mtd_del_partition(struct mtd_info *m
  }
  EXPORT_SYMBOL_GPL(mtd_del_partition);
  
@@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
  #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #define SPLIT_FIRMWARE_NAME	CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #else
-@@ -770,6 +800,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition);
+@@ -757,6 +787,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition);
  
  static void split_firmware(struct mtd_info *master, struct mtd_part *part)
  {
@@ -55,7 +55,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
  }
  
  void __weak arch_split_mtd_part(struct mtd_info *master, const char *name,
-@@ -784,6 +815,12 @@ static void mtd_partition_split(struct m
+@@ -771,6 +802,12 @@ static void mtd_partition_split(struct m
  	if (rootfs_found)
  		return;
  
diff --git a/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch
index a08f46c..076ec31 100644
--- a/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch
+++ b/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch
@@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
 
 --- a/drivers/mtd/mtdpart.c
 +++ b/drivers/mtd/mtdpart.c
-@@ -792,6 +792,17 @@ run_parsers_by_type(struct mtd_part *sla
+@@ -779,6 +779,17 @@ run_parsers_by_type(struct mtd_part *sla
  	return nr_parts;
  }
  
@@ -29,7 +29,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
  #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #define SPLIT_FIRMWARE_NAME	CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #else
-@@ -1244,6 +1255,24 @@ int mtd_is_partition(const struct mtd_in
+@@ -1232,6 +1243,24 @@ int mtd_is_partition(const struct mtd_in
  }
  EXPORT_SYMBOL_GPL(mtd_is_partition);
  
diff --git a/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch
index 9a58521..e925983 100644
--- a/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch
+++ b/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch
@@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  
  		if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
  			instr->fail_addr -= part->offset;
-@@ -591,19 +660,22 @@ static struct mtd_part *allocate_partiti
+@@ -578,19 +647,22 @@ static struct mtd_part *allocate_partiti
  	remainder = do_div(tmp, wr_alignment);
  	if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) {
  		/* Doesn't start on a boundary of major erase size */



More information about the lede-commits mailing list