[PATCH] devres: Use the correct devres implementation in SPL builds

Alban Bedel alban.bedel at aerq.com
Tue Apr 19 10:14:04 CEST 2022


When CONFIG_DEVRES is set, but CONFIG_SPL_DM is not set devres code is
not included in the SPL. But dm/devres.h only check for CONFIG_DEVRES
to select if the full implementation should be used. So if any devres
function is used in the SPL with this config the link fails.

Fix the ifdef in the dm/devres.h to also check for CONFIG_SPL_DM in
SPL builds.

Signed-off-by: Alban Bedel <alban.bedel at aerq.com>
---
 include/dm/devres.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/dm/devres.h b/include/dm/devres.h
index 0ab277ec38e9..8765b73d5e90 100644
--- a/include/dm/devres.h
+++ b/include/dm/devres.h
@@ -30,7 +30,8 @@ struct devres_stats {
 	int total_size;
 };
 
-#ifdef CONFIG_DEVRES
+/* devres is not available in SPL unless DM is enabled there */
+#if defined(CONFIG_DEVRES) && CONFIG_IS_ENABLED(DM)
 
 #ifdef CONFIG_DEBUG_DEVRES
 void *__devres_alloc(dr_release_t release, size_t size, gfp_t gfp,
-- 
2.32.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3627 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220419/b67ef8fc/attachment.bin>


More information about the U-Boot mailing list