063-v4.11-0003-mtd-Add-partition-device-node-to-mtd-partition-devic.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From 42e9401bd1467d22c4dc4d2c637347b874e6a80b Mon Sep 17 00:00:00 2001
  2. From: Sascha Hauer <s.hauer@pengutronix.de>
  3. Date: Thu, 9 Feb 2017 11:50:24 +0100
  4. Subject: [PATCH] mtd: Add partition device node to mtd partition devices
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. The user visible change here is that mtd partitions get an of_node link
  9. in sysfs.
  10. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
  11. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
  12. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
  13. ---
  14. drivers/mtd/mtdpart.c | 1 +
  15. drivers/mtd/ofpart.c | 1 +
  16. include/linux/mtd/partitions.h | 1 +
  17. 3 files changed, 3 insertions(+)
  18. --- a/drivers/mtd/mtdpart.c
  19. +++ b/drivers/mtd/mtdpart.c
  20. @@ -432,6 +432,7 @@ static struct mtd_part *allocate_partiti
  21. slave->mtd.dev.parent = IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) ?
  22. &master->dev :
  23. master->dev.parent;
  24. + slave->mtd.dev.of_node = part->of_node;
  25. slave->mtd._read = part_read;
  26. slave->mtd._write = part_write;
  27. --- a/drivers/mtd/ofpart.c
  28. +++ b/drivers/mtd/ofpart.c
  29. @@ -108,6 +108,7 @@ static int parse_ofpart_partitions(struc
  30. parts[i].offset = of_read_number(reg, a_cells);
  31. parts[i].size = of_read_number(reg + a_cells, s_cells);
  32. + parts[i].of_node = pp;
  33. partname = of_get_property(pp, "label", &len);
  34. if (!partname)
  35. --- a/include/linux/mtd/partitions.h
  36. +++ b/include/linux/mtd/partitions.h
  37. @@ -41,6 +41,7 @@ struct mtd_partition {
  38. uint64_t size; /* partition size */
  39. uint64_t offset; /* offset within the master MTD space */
  40. uint32_t mask_flags; /* master MTD flags to mask out for this partition */
  41. + struct device_node *of_node;
  42. };
  43. #define MTDPART_OFS_RETAIN (-3)