mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: asm: simplify arm_mem_stack_top
@ 2023-01-04  7:28 Ahmad Fatoum
  2023-01-04  9:11 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-01-04  7:28 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

<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@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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: asm: simplify arm_mem_stack_top
  2023-01-04  7:28 [PATCH] ARM: asm: simplify arm_mem_stack_top Ahmad Fatoum
@ 2023-01-04  9:11 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-01-04  9:11 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Wed, Jan 04, 2023 at 08:28:48AM +0100, Ahmad Fatoum wrote:
> <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@pengutronix.de>
> ---
>  arch/arm/include/asm/barebox-arm.h | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)

Applied, thanks

Sascha

> 
> 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
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-04  9:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04  7:28 [PATCH] ARM: asm: simplify arm_mem_stack_top Ahmad Fatoum
2023-01-04  9:11 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox