Skip to contentSkip to conversation

mtd: parsers: ofpart: allow 0xff size cells to denote 'rest-of-flash'

PATCH New Alexander Vickberg 1 participant 1 message Jun 15, 2022 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: parsers: ofpart: allow 0xff size cells to denote 'rest-of-flash'

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.

---
 drivers/mtd/parsers/ofpart_core.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mtd/parsers/ofpart_core.c +3 -0
index 192190c42fc8..33372ba018d8 100644
@@ -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);
Signature · 6 lines
2.34.1


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