[PATCH] ARM: asm: simplify arm_mem_stack_top

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Jan 3 23:28:48 PST 2023


<asm-generic/memory_layout.h> always defines OPTEE_SIZE and sets it
to zero when CONFIG_OPTEE_SIZE is undefined. As CONFIG_OPTEE_SIZE
definition is dependent on BOOTM_OPTEE || PBL_OPTEE, we can replace
the #ifdeffery and directly use OPTEE_SIZE in the macro.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/include/asm/barebox-arm.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 2dcd4153200f..515525e49d31 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -80,13 +80,7 @@ static inline const void *arm_mem_scratch_get(void)
 	return (const void *)__arm_mem_scratch(arm_mem_endmem_get());
 }
 
-#define __arm_mem_stack_top(membase, endmem) ((endmem) - SZ_64K)
-
-#if defined(CONFIG_BOOTM_OPTEE) || defined(CONFIG_PBL_OPTEE)
-#define arm_mem_stack_top(membase, endmem) (__arm_mem_stack_top(membase, endmem) - OPTEE_SIZE)
-#else
-#define arm_mem_stack_top(membase, endmem)  __arm_mem_stack_top(membase, endmem)
-#endif
+#define arm_mem_stack_top(membase, endmem) ((endmem) - SZ_64K - OPTEE_SIZE)
 
 static inline unsigned long arm_mem_stack(unsigned long membase,
 					  unsigned long endmem)
-- 
2.30.2




More information about the barebox mailing list