diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-24 10:52:14 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-25 09:27:07 +0200 |
commit | 04a6e765f70aaf7614ec62a7955d9f07b4309a17 (patch) | |
tree | aab73d24734322e3ab4015de08b1a9bb14ce3426 /common | |
parent | 2bfa06b62e7c1f327a01f45f756136b7c7f802dd (diff) | |
download | barebox-04a6e765f70aaf7614ec62a7955d9f07b4309a17.tar.gz barebox-04a6e765f70aaf7614ec62a7955d9f07b4309a17.tar.xz |
firmware: recognize by reproducible name
firmwaremgr_find_by_node() matches the device node pointers to find the
firmware manager associated to a node. This function is called by the
of_overlay code when it finds a firmware-name property to find a firmware
manager for this node. This works when the overlay is applied to the
live tree, but not when it's applied to the tree we are going to load
the kernel with. To overcome this limitation match by the nodes
reproducible name instead of pointers.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.barebox.org/20210624085223.14616-10-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/firmware.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/common/firmware.c b/common/firmware.c index bb76a16050..b33acff77f 100644 --- a/common/firmware.c +++ b/common/firmware.c @@ -68,10 +68,22 @@ struct firmware_mgr *firmwaremgr_find(const char *id) struct firmware_mgr *firmwaremgr_find_by_node(struct device_node *np) { struct firmware_mgr *mgr; + char *na, *nb; - list_for_each_entry(mgr, &firmwaremgr_list, list) - if (mgr->handler->device_node == np) + na = of_get_reproducible_name(np); + + list_for_each_entry(mgr, &firmwaremgr_list, list) { + nb = of_get_reproducible_name(mgr->handler->device_node); + if (!strcmp(na, nb)) { + free(na); + free(nb); return mgr; + } + + free(nb); + } + + free(na); return NULL; } |