From 04a6e765f70aaf7614ec62a7955d9f07b4309a17 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 24 Jun 2021 10:52:14 +0200 Subject: 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 Link: https://lore.barebox.org/20210624085223.14616-10-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer --- common/firmware.c | 16 ++++++++++++++-- 1 file 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; } -- cgit v1.2.3