119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. From e62ff8f02eb3ae35ae7ece7c5272a689fd8b0bcd Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <[email protected]>
  3. Date: Fri, 27 Jul 2018 21:37:48 +0200
  4. Subject: [PATCH] Revert "mtd: partitions: use DT info for parsing partitions
  5. with "compatible" prop"
  6. This reverts commit 76a832254ab05502c9394cc51ded6f0abe0e0bee.
  7. ---
  8. drivers/mtd/mtdpart.c | 33 ++++++++++++++++++++-------------
  9. 1 file changed, 20 insertions(+), 13 deletions(-)
  10. --- a/drivers/mtd/mtdpart.c
  11. +++ b/drivers/mtd/mtdpart.c
  12. @@ -453,6 +453,22 @@ static inline void free_partition(struct
  13. kfree(p);
  14. }
  15. +/**
  16. + * mtd_parse_part - parse MTD partition looking for subpartitions
  17. + *
  18. + * @slave: part that is supposed to be a container and should be parsed
  19. + * @types: NULL-terminated array with names of partition parsers to try
  20. + *
  21. + * Some partitions are kind of containers with extra subpartitions (volumes).
  22. + * There can be various formats of such containers. This function tries to use
  23. + * specified parsers to analyze given partition and registers found
  24. + * subpartitions on success.
  25. + */
  26. +static int mtd_parse_part(struct mtd_part *slave, const char *const *types)
  27. +{
  28. + return parse_mtd_partitions(&slave->mtd, types, NULL);
  29. +}
  30. +
  31. static struct mtd_part *allocate_partition(struct mtd_info *parent,
  32. const struct mtd_partition *part, int partno,
  33. uint64_t cur_offset)
  34. @@ -924,8 +940,8 @@ int add_mtd_partitions(struct mtd_info *
  35. add_mtd_device(&slave->mtd);
  36. mtd_partition_split(master, slave);
  37. mtd_add_partition_attrs(slave);
  38. - /* Look for subpartitions */
  39. - parse_mtd_partitions(&slave->mtd, parts[i].types, NULL);
  40. + if (parts[i].types)
  41. + mtd_parse_part(slave, parts[i].types);
  42. cur_offset = slave->offset + slave->mtd.size;
  43. }
  44. @@ -1037,12 +1053,6 @@ static const char * const default_mtd_pa
  45. NULL
  46. };
  47. -/* Check DT only when looking for subpartitions. */
  48. -static const char * const default_subpartition_types[] = {
  49. - "ofpart",
  50. - NULL
  51. -};
  52. -
  53. static int mtd_part_do_parse(struct mtd_part_parser *parser,
  54. struct mtd_info *master,
  55. struct mtd_partitions *pparts,
  56. @@ -1113,9 +1123,7 @@ static int mtd_part_of_parse(struct mtd_
  57. const char *fixed = "fixed-partitions";
  58. int ret, err = 0;
  59. - np = mtd_get_of_node(master);
  60. - if (!mtd_is_partition(master))
  61. - np = of_get_child_by_name(np, "partitions");
  62. + np = of_get_child_by_name(mtd_get_of_node(master), "partitions");
  63. of_property_for_each_string(np, "compatible", prop, compat) {
  64. parser = mtd_part_get_compatible_parser(compat);
  65. if (!parser)
  66. @@ -1185,8 +1193,7 @@ int parse_mtd_partitions(struct mtd_info
  67. }
  68. if (!types)
  69. - types = mtd_is_partition(master) ? default_subpartition_types :
  70. - default_mtd_part_types;
  71. + types = default_mtd_part_types;
  72. for ( ; *types; types++) {
  73. /*