linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: parsers: ofpart: allow 0xff size cells to denote 'rest-of-flash'
@ 2022-06-15  8:27 Alexander Vickberg
  0 siblings, 0 replies; only message in thread
From: Alexander Vickberg @ 2022-06-15  8:27 UTC (permalink / raw)
  To: linux-mtd; +Cc: Alexander Vickberg

In cmdlinepart it's possible to use '-' as partition size to denote rest of
available flash size. This patch brings this functionality to ofpart. If all
size cells are set to all 0xff's ofpart will use rest of available flash size.

Signed-off-by: Alexander Vickberg <wickbergster@gmail.com>
---
 drivers/mtd/parsers/ofpart_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/parsers/ofpart_core.c b/drivers/mtd/parsers/ofpart_core.c
index 192190c42fc8..33372ba018d8 100644
--- a/drivers/mtd/parsers/ofpart_core.c
+++ b/drivers/mtd/parsers/ofpart_core.c
@@ -133,6 +133,9 @@ static int parse_fixed_partitions(struct mtd_info *master,
 		parts[i].size = of_read_number(reg + a_cells, s_cells);
 		parts[i].of_node = pp;
 
+		if (!memchr_inv(reg + a_cells, 0xff, s_cells<<2))
+			parts[i].size = master->size - parts[i].offset;
+
 		partname = of_get_property(pp, "label", &len);
 		if (!partname)
 			partname = of_get_property(pp, "name", &len);
-- 
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-15  8:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15  8:27 [PATCH] mtd: parsers: ofpart: allow 0xff size cells to denote 'rest-of-flash' Alexander Vickberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).