067-v4.17-0002-mtd-ofpart-add-of_match_table-with-fixed-partitions.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 4ac9222778478a00c7fc9d347b7ed1e0e595120d Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <[email protected]>
  3. Date: Thu, 4 Jan 2018 08:05:34 +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 <[email protected]>
  15. Reviewed-by: Brian Norris <[email protected]>
  16. Tested-by: Brian Norris <[email protected]>
  17. Signed-off-by: Boris Brezillon <[email protected]>
  18. ---
  19. drivers/mtd/ofpart.c | 7 +++++++
  20. 1 file changed, 7 insertions(+)
  21. --- a/drivers/mtd/ofpart.c
  22. +++ b/drivers/mtd/ofpart.c
  23. @@ -140,9 +140,16 @@ ofpart_none:
  24. return ret;
  25. }
  26. +static const struct of_device_id parse_ofpart_match_table[] = {
  27. + { .compatible = "fixed-partitions" },
  28. + {},
  29. +};
  30. +MODULE_DEVICE_TABLE(of, parse_ofpart_match_table);
  31. +
  32. static struct mtd_part_parser ofpart_parser = {
  33. .parse_fn = parse_ofpart_partitions,
  34. .name = "ofpart",
  35. + .of_match_table = parse_ofpart_match_table,
  36. };
  37. static int parse_ofoldpart_partitions(struct mtd_info *master,