diff mbox series

devres: Use the correct devres implementation in SPL builds

Message ID 20220419081404.75391-1-alban.bedel@aerq.com
State Handled Elsewhere
Delegated to: Tom Rini
Headers show
Series devres: Use the correct devres implementation in SPL builds | expand

Commit Message

Bedel, Alban April 19, 2022, 8:14 a.m. UTC
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@aerq.com>
---
 include/dm/devres.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Tom Rini May 8, 2022, 3:30 p.m. UTC | #1
On Tue, Apr 19, 2022 at 10:14:04AM +0200, Alban Bedel wrote:

> 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@aerq.com>

I believe this has been fixed with:
commit 092d5c2a83b730844aeaa5ac300ddc7f13a75f49
Author: Simon Glass <sjg@chromium.org>
Date:   Sun Mar 27 14:26:19 2022 -0600

    dm: core: Allow devres to be disabled in SPL
    
    At present if devres is enabled in U-Boot proper it is enabled in SPL.
    We don't normally want it there, so disable it.
    
    Signed-off-by: Simon Glass <sjg@chromium.org>
    Tested-by: Angus Ainslie <angus@akkea.ca>
Bedel, Alban May 13, 2022, 10:26 a.m. UTC | #2
On Sun, 2022-05-08 at 11:30 -0400, Tom Rini wrote:
> I believe this has been fixed with:
> commit 092d5c2a83b730844aeaa5ac300ddc7f13a75f49

Thanks for letting me know, I tested a build with this commit and
everything is working fine.

---
Alban
diff mbox series

Patch

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,