kernel: backport mtd implementation for "compatible" in "partitions" subnode
[openwrt/staging/stintel.git] / target / linux / generic / pending-4.14 / 160-mtd-part-add-generic-parsing-of-linux-part-probe.patch
index 2706f13dc9d19f788ab5eb4c7104efde6be6a471..e57214ba05f83077a22db249bfcb2fc2d31800ce 100644 (file)
@@ -102,9 +102,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  #include <linux/mtd/partitions.h>
 +#include <linux/of.h>
  #include <linux/err.h>
+ #include <linux/of.h>
  
- #include "mtdcore.h"
-@@ -863,6 +864,32 @@ void deregister_mtd_parser(struct mtd_pa
+@@ -864,6 +865,32 @@ void deregister_mtd_parser(struct mtd_pa
  EXPORT_SYMBOL_GPL(deregister_mtd_parser);
  
  /*
@@ -137,9 +137,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
   * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you
   * are changing this array!
   */
-@@ -920,6 +947,13 @@ int parse_mtd_partitions(struct mtd_info
- {
-       struct mtd_part_parser *parser;
+@@ -963,6 +990,13 @@ int parse_mtd_partitions(struct mtd_info
+       struct property *prop;
+       const char *compat;
        int ret, err = 0;
 +      const char *const *types_of = NULL;
 +
@@ -149,9 +149,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 +                      types = types_of;
 +      }
  
-       if (!types)
-               types = default_mtd_part_types;
-@@ -945,6 +979,7 @@ int parse_mtd_partitions(struct mtd_info
+       np = of_get_child_by_name(mtd_get_of_node(master), "partitions");
+       of_property_for_each_string(np, "compatible", prop, compat) {
+@@ -1004,6 +1038,7 @@ int parse_mtd_partitions(struct mtd_info
                if (ret < 0 && !err)
                        err = ret;
        }