mtd: Add partition device node to mtd partition devices

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sun Feb 12 18:59:06 PST 2017


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=42e9401bd1467d22c4dc4d2c637347b874e6a80b
Commit:     42e9401bd1467d22c4dc4d2c637347b874e6a80b
Parent:     89a0d9a9f1941a086a82bc7cd73d275cec98ba14
Author:     Sascha Hauer <s.hauer at pengutronix.de>
AuthorDate: Thu Feb 9 11:50:24 2017 +0100
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Thu Feb 9 19:19:25 2017 -0800

    mtd: Add partition device node to mtd partition devices
    
    The user visible change here is that mtd partitions get an of_node link
    in sysfs.
    
    Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/mtdpart.c          | 1 +
 drivers/mtd/ofpart.c           | 1 +
 include/linux/mtd/partitions.h | 1 +
 3 files changed, 3 insertions(+)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 08925bb..ea5e530 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -432,6 +432,7 @@ static struct mtd_part *allocate_partition(struct mtd_info *master,
 	slave->mtd.dev.parent = IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) ?
 				&master->dev :
 				master->dev.parent;
+	slave->mtd.dev.of_node = part->of_node;
 
 	slave->mtd._read = part_read;
 	slave->mtd._write = part_write;
diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index ede407d..4644701 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -108,6 +108,7 @@ static int parse_ofpart_partitions(struct mtd_info *master,
 
 		parts[i].offset = of_read_number(reg, a_cells);
 		parts[i].size = of_read_number(reg + a_cells, s_cells);
+		parts[i].of_node = pp;
 
 		partname = of_get_property(pp, "label", &len);
 		if (!partname)
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 70736e1..06df1e0 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -41,6 +41,7 @@ struct mtd_partition {
 	uint64_t size;			/* partition size */
 	uint64_t offset;		/* offset within the master MTD space */
 	uint32_t mask_flags;		/* master MTD flags to mask out for this partition */
+	struct device_node *of_node;
 };
 
 #define MTDPART_OFS_RETAIN	(-3)



More information about the linux-mtd-cvs mailing list