041-v4.17-0003-mtd-ofpart-add-of_match_table-with-fixed-partitions.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From 97b0c7c0df3efd7048ed39d7e2dee34cafd55887 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  3. Date: Wed, 14 Mar 2018 13:10:44 +0100
  4. Subject: [PATCH] mtd: ofpart: add of_match_table with "fixed-partitions"
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. This allows using this parser with any flash driver that takes care of
  9. setting of_node (using mtd_set_of_node helper) correctly. Up to now
  10. support for "fixed-partitions" DT compatibility string was working only
  11. with flash drivers that were specifying "ofpart" (manually or by letting
  12. mtd use the default set of parsers).
  13. This matches existing bindings documentation.
  14. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  15. Reviewed-by: Brian Norris <computersforpeace@gmail.com>
  16. Tested-by: Brian Norris <computersforpeace@gmail.com>
  17. Reviewed-by: Richard Weinberger <richard@nod.at>
  18. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
  19. ---
  20. drivers/mtd/ofpart.c | 7 +++++++
  21. 1 file changed, 7 insertions(+)
  22. --- a/drivers/mtd/ofpart.c
  23. +++ b/drivers/mtd/ofpart.c
  24. @@ -140,9 +140,16 @@ ofpart_none:
  25. return ret;
  26. }
  27. +static const struct of_device_id parse_ofpart_match_table[] = {
  28. + { .compatible = "fixed-partitions" },
  29. + {},
  30. +};
  31. +MODULE_DEVICE_TABLE(of, parse_ofpart_match_table);
  32. +
  33. static struct mtd_part_parser ofpart_parser = {
  34. .parse_fn = parse_fixed_partitions,
  35. .name = "fixed-partitions",
  36. + .of_match_table = parse_ofpart_match_table,
  37. };
  38. static int parse_ofoldpart_partitions(struct mtd_info *master,