ea68fc474f1917820cfb9d93fa3e31760402422d
[openwrt/staging/mkresin.git] /
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
9 The user visible change here is that mtd partitions get an of_node link
10 in sysfs.
11
12 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
13 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
14 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
15 ---
16 drivers/mtd/mtdpart.c | 1 +
17 drivers/mtd/ofpart.c | 1 +
18 include/linux/mtd/partitions.h | 1 +
19 3 files changed, 3 insertions(+)
20
21 --- a/drivers/mtd/mtdpart.c
22 +++ b/drivers/mtd/mtdpart.c
23 @@ -432,6 +432,7 @@ static struct mtd_part *allocate_partiti
24 slave->mtd.dev.parent = IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) ?
25 &master->dev :
26 master->dev.parent;
27 + slave->mtd.dev.of_node = part->of_node;
28
29 slave->mtd._read = part_read;
30 slave->mtd._write = part_write;
31 --- a/drivers/mtd/ofpart.c
32 +++ b/drivers/mtd/ofpart.c
33 @@ -108,6 +108,7 @@ static int parse_ofpart_partitions(struc
34
35 parts[i].offset = of_read_number(reg, a_cells);
36 parts[i].size = of_read_number(reg + a_cells, s_cells);
37 + parts[i].of_node = pp;
38
39 partname = of_get_property(pp, "label", &len);
40 if (!partname)
41 --- a/include/linux/mtd/partitions.h
42 +++ b/include/linux/mtd/partitions.h
43 @@ -41,6 +41,7 @@ struct mtd_partition {
44 uint64_t size; /* partition size */
45 uint64_t offset; /* offset within the master MTD space */
46 uint32_t mask_flags; /* master MTD flags to mask out for this partition */
47 + struct device_node *of_node;
48 };
49
50 #define MTDPART_OFS_RETAIN (-3)