[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210216212638.28382-2-ansuelsmth@gmail.com>
Date: Tue, 16 Feb 2021 22:26:26 +0100
From: Ansuel Smith <ansuelsmth@...il.com>
To: Richard Weinberger <richard@....at>
Cc: Ansuel Smith <ansuelsmth@...il.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Vignesh Raghavendra <vigneshr@...com>,
Rob Herring <robh+dt@...nel.org>,
Boris Brezillon <bbrezillon@...nel.org>,
linux-mtd@...ts.infradead.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 1/3] mtd: partitions: ofpart: skip subnodes parse with compatible
If a partitions structure is not used, parse direct subnodes as
fixed-partitions only if a compatible is not found or is of type
fixed-partition. A parser can be used directly on the subnode and
subnodes should not be parsed as fixed-partitions by default.
Signed-off-by: Ansuel Smith <ansuelsmth@...il.com>
---
drivers/mtd/parsers/ofpart.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mtd/parsers/ofpart.c b/drivers/mtd/parsers/ofpart.c
index daf507c123e6..4b363dd0311c 100644
--- a/drivers/mtd/parsers/ofpart.c
+++ b/drivers/mtd/parsers/ofpart.c
@@ -50,6 +50,11 @@ static int parse_fixed_partitions(struct mtd_info *master,
master->name, mtd_node);
ofpart_node = mtd_node;
dedicated = false;
+
+ /* Skip parsing direct subnodes if a compatible is found and is not fixed-partitions */
+ if (node_has_compatible(ofpart_node) &&
+ !of_device_is_compatible(ofpart_node, "fixed-partitions"))
+ return 0;
} else if (!of_device_is_compatible(ofpart_node, "fixed-partitions")) {
/* The 'partitions' subnode might be used by another parser */
return 0;
--
2.30.0
Powered by blists - more mailing lists