[PATCH 2/2] mtd: core: find OF node for every MTD partition
Rafał Miłecki
zajec5 at gmail.com
Thu Jul 7 09:36:07 PDT 2022
From: Rafał Miłecki <rafal at milecki.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 at milecki.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
More information about the linux-mtd
mailing list