kernel: move diff adding run_parsers_by_type() between mtd patches
authorRafał Miłecki <rafal@milecki.pl>
Tue, 20 Nov 2018 13:28:25 +0000 (14:28 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Tue, 20 Nov 2018 13:44:01 +0000 (14:44 +0100)
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>
target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch
target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch
target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch

index 9dd1eaf04f0660d521595ca5ed380ed013c8439b..a48ae87ea24996561114de43901550d7b0aed22d 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_
+@@ -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_
        }
  }
  
index 0eeb4c7d013fdfc43724881cc0521cf141498787..3c105b2a47fc6d6509e9e86a3bf4ea1a7461452b 100644 (file)
@@ -10,44 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- 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 <juhosg@openwrt.org>
  }
  
  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;
  
index 15d76a7059a23a287065c35447960c3cde9dddbe..0eb6d7422ded9f112194debbf2ff09ffc874d44d 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
-@@ -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_
        }
  }
  
index 293ed33c91385e90e43b19bb40221677b7983c0f..3cb27c7605dc7b6efe8fae281e4b2e195cb47b11 100644 (file)
@@ -10,44 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- 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 <juhosg@openwrt.org>
  }
  
  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;