kernel: bump 4.14 to 4.14.89
[oweals/openwrt.git] / target / linux / generic / pending-4.14 / 401-mtd-add-support-for-different-partition-parser-types.patch
index 9dd1eaf04f0660d521595ca5ed380ed013c8439b..359c4c167bbe9c1a7f3878468e1b195b98eff9aa 100644 (file)
@@ -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_
+@@ -751,6 +755,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
+@@ -1122,6 +1156,61 @@ void mtd_part_parser_cleanup(struct mtd_
        }
  }