[PATCH v2 06/16] bootsource: stub out when in PBL

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Nov 25 07:12:18 PST 2024


To optimize out calls to undefined functions in PBL at compile-time
instead of link time, let's use IS_PROPER instead of IS_ENABELED(),
so the remainder of the code is skipped in PBL build instead of relying
on linker garbage collection.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 common/bootsource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/bootsource.c b/common/bootsource.c
index 6808c9c51d88..d82bb5f18c52 100644
--- a/common/bootsource.c
+++ b/common/bootsource.c
@@ -158,7 +158,7 @@ int bootsource_of_alias_xlate(enum bootsource src, int instance)
 	struct device_node *np;
 	int alias_id;
 
-	if (!IS_ENABLED(CONFIG_OFDEVICE))
+	if (!IS_ENABLED(CONFIG_OFDEVICE) || IN_PBL)
 		return BOOTSOURCE_INSTANCE_UNKNOWN;
 
 	if (src == BOOTSOURCE_UNKNOWN ||
-- 
2.39.5




More information about the barebox mailing list