[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 7 Jul 2022 18:36:07 +0200
From: Rafał Miłecki <zajec5@...il.com>
To: Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>
Cc: ansuelsmth@...il.com, linux-mtd@...ts.infradead.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Rafał Miłecki <rafal@...ecki.pl>
Subject: [PATCH 2/2] mtd: core: find OF node for every MTD partition
From: Rafał Miłecki <rafal@...ecki.pl>
Don't limit this feature to the "nvmem-cells". There are more cases to
this.
1. Dynamic partitions may need to be handled with parsers
This applies to "fixed-partitions" parser and all custom ones.
2. Dynamic partitions can be handled with specific drivers
Consider "u-boot,env" as specified in the u-boot,env.yaml.
Signed-off-by: Rafał Miłecki <rafal@...ecki.pl>
---
drivers/mtd/mtdcore.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 79c447fe30b4..f7693736dde4 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -552,7 +552,6 @@ static void mtd_check_of_node(struct mtd_info *mtd)
const char *pname, *prefix = "partition-";
int plen, mtd_name_len, offset, prefix_len;
struct mtd_info *parent;
- bool found = false;
/* Check if MTD already has a device node */
if (dev_of_node(&mtd->dev))
@@ -588,19 +587,11 @@ static void mtd_check_of_node(struct mtd_info *mtd)
plen = strlen(pname) - offset;
if (plen == mtd_name_len &&
!strncmp(mtd->name, pname + offset, plen)) {
- found = true;
+ mtd_set_of_node(mtd, mtd_dn);
break;
}
}
- if (!found)
- goto exit_partitions;
-
- /* Set of_node only for nvmem */
- if (of_device_is_compatible(mtd_dn, "nvmem-cells"))
- mtd_set_of_node(mtd, mtd_dn);
-
-exit_partitions:
of_node_put(partitions);
exit_parent:
of_node_put(parent_dn);
--
2.34.1
Powered by blists - more mailing lists