1 From 3b6521eab0386a4854d47b1a01947d7dc46ec98d Mon Sep 17 00:00:00 2001
2 From: Brian Norris <computersforpeace@gmail.com>
3 Date: Fri, 30 Oct 2015 20:33:21 -0700
4 Subject: [PATCH] mtd: ofpart: grab device tree node directly from master
7 It seems more logical to use a device node directly associated with the
8 MTD master device (i.e., mtd->dev.of_node field) rather than requiring
9 auxiliary partition parser information to be passed in by the driver in
12 This patch supports the mtd->dev.of_node field and deprecates the parser
15 Driver conversions may now follow.
17 Additional side benefit to assigning mtd->dev.of_node rather than using
18 parser data: the driver core will automatically create a device -> node
21 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
22 Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
24 drivers/mtd/ofpart.c | 18 ++++++++++--------
25 include/linux/mtd/partitions.h | 4 +++-
26 2 files changed, 13 insertions(+), 9 deletions(-)
28 --- a/drivers/mtd/ofpart.c
29 +++ b/drivers/mtd/ofpart.c
30 @@ -37,10 +37,11 @@ static int parse_ofpart_partitions(struc
31 bool dedicated = true;
37 - mtd_node = data->of_node;
39 + * of_node can be provided through auxiliary parser data or (preferred)
40 + * by assigning the master device node
42 + mtd_node = data && data->of_node ? data->of_node : mtd_get_of_node(master);
46 @@ -157,10 +158,11 @@ static int parse_ofoldpart_partitions(st
55 + * of_node can be provided through auxiliary parser data or (preferred)
56 + * by assigning the master device node
58 + dp = data && data->of_node ? data->of_node : mtd_get_of_node(master);
62 --- a/include/linux/mtd/partitions.h
63 +++ b/include/linux/mtd/partitions.h
64 @@ -56,7 +56,9 @@ struct device_node;
66 * struct mtd_part_parser_data - used to pass data to MTD partition parsers.
67 * @origin: for RedBoot, start address of MTD device
68 - * @of_node: for OF parsers, device node containing partitioning information
69 + * @of_node: for OF parsers, device node containing partitioning information.
70 + * This field is deprecated, as the device node should simply be
71 + * assigned to the master struct device.
73 struct mtd_part_parser_data {