arm: omap3: Make functions static when possible
Subsystems (3)
v2 cover arm: omap3: Make functions static when possible
A few functions are defined without being labeled as static to that file. In an effort to keep SPL as small as possible, one function needs to be moved into an #ifdef so it's only enabled when the calling function is available, and all of these can simply be marked as static.
Before:
text data bss dec hex filename
50988 1053 1888 53929 d2a9 spl/u-boot-spl
After:
text data bss dec hex filename
50972 1053 1888 53913 d299 spl/u-boot-spl
While not significant, a few bytes can be very helpful when SPL is limited.
Adam Ford (3):
arm: omap3: Make try_unlock_memory() static
arm: omap3: Make secureworld_exit() static
arm: omap3: Make secure_unlock_mem() static
arch/arm/include/asm/arch-omap3/sys_proto.h | 2 -- arch/arm/mach-omap2/omap3/board.c | 21 +++++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/3 arm: omap3: Make try_unlock_memory() static
try_unlock_memory() is only used in one file, so make it static in that file,remove it from the sys_proto header file, and relocate it into the #ifdef section that call it. This will make it only built under the conditions when it is called, and it may help with some further optimization in the future.
--- arch/arm/include/asm/arch-omap3/sys_proto.h | 1 - arch/arm/mach-omap2/omap3/board.c | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/include/asm/arch-omap3/sys_proto.h +0 -1
@@ -60,7 +60,6 @@ u32 is_running_in_sram(void);u32 is_running_in_flash (void );u32 get_device_type (void );void secureworld_exit (void ); -void try_unlock_memory (void );u32 get_boot_type (void );void invalidate_dcache (u32 );u32 wait_on_value (u32 ,u32 ,void *,u32 );
arch/arm/mach-omap2/omap3/board.c +9 -8
@@ -140,12 +140,20 @@ void secureworld_exit(void) __asm__ __volatile__("mcr p15, 0, %0, c1, c1, 0" :"=r" (i)); } +void early_system_init (void ) +{ +hw_data_init (); +} + +#if !defined(CONFIG_SKIP_LOWLEVEL_INIT ) && \ + !defined(CONFIG_SKIP_LOWLEVEL_INIT_ONLY ) +/****************************************************************************** * Routine: try_unlock_sram() * Description: If chip is GP/EMU(special) type, unlock the SRAM for * general use. *****************************************************************************/ -void try_unlock_memory (void ) +static void try_unlock_memory (void ) {int mode;int in_sdram =is_running_in_sdram ();
@@ -174,13 +182,6 @@ void try_unlock_memory(void)return ; } -void early_system_init (void ) -{ -hw_data_init (); -} - -#if !defined(CONFIG_SKIP_LOWLEVEL_INIT ) && \ - !defined(CONFIG_SKIP_LOWLEVEL_INIT_ONLY )/****************************************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks.
Signature · 1 line
2.25.1
PATCH v2 2/3 arm: omap3: Make secureworld_exit() static
In reply to Adam Fordsecureworld_exit() is only used in one file, so make it static to that file and remove it from sys_proto.h. This may help with some further optimization in the future.
--- arch/arm/include/asm/arch-omap3/sys_proto.h | 1 - arch/arm/mach-omap2/omap3/board.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
arch/arm/include/asm/arch-omap3/sys_proto.h +0 -1
@@ -59,7 +59,6 @@ u32 is_running_in_sdram(void);u32 is_running_in_sram (void );u32 is_running_in_flash (void );u32 get_device_type (void ); -void secureworld_exit (void );u32 get_boot_type (void );void invalidate_dcache (u32 );u32 wait_on_value (u32 ,u32 ,void *,u32 );
arch/arm/mach-omap2/omap3/board.c +1 -1
@@ -114,7 +114,7 @@ void secure_unlock_mem(void)* configure secure registers and exit secure world * general use. *****************************************************************************/ -void secureworld_exit (void ) +static void secureworld_exit (void ) {unsigned long i;
Signature · 1 line
2.25.1
PATCH v2 3/3 arm: omap3: Make secure_unlock_mem() static
In reply to Adam Fordsecure_unlock_mem() is only used in one file, so make it static in that file. This
may help with some further optimization in the future.
--- arch/arm/mach-omap2/omap3/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/omap3/board.c +1 -1
@@ -76,7 +76,7 @@ const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx;* Description: Setup security registers for access * (GP Device only) *****************************************************************************/ -void secure_unlock_mem (void ) +static void secure_unlock_mem (void ) {struct pm *pm_rt_ape_base = (struct pm *)PM_RT_APE_BASE_ADDR_ARM ;struct pm *pm_gpmc_base = (struct pm *)PM_GPMC_BASE_ADDR_ARM ;
Signature · 1 line
2.25.1
v2 cover arm: omap3: Make functions static when possible
In reply to Adam FordQuoted 5 lines · Adam Ford
A few functions are defined without being labeled as static to that file. In an effort to keep SPL as small as possible, one function needs to be moved into an #ifdef so it's only enabled when the calling function is available, and all of these can simply be marked as static.
I see some failures with this series. Can you take a look:
https://source.denx.de/u-boot/custodians/u-boot-ti/-/jobs/254794
Thanks and regards,
Lokesh
Quoted 20 lines
Before:
text data bss dec hex filename
50988 1053 1888 53929 d2a9 spl/u-boot-splAfter:
text data bss dec hex filename
50972 1053 1888 53913 d299 spl/u-boot-splWhile not significant, a few bytes can be very helpful when SPL is limited.
Adam Ford (3):
arm: omap3: Maketry_unlock_memory()static
arm: omap3: Makesecureworld_exit()static
arm: omap3: Makesecure_unlock_mem()staticarch/arm/include/asm/arch-omap3/sys_proto.h | 2 -- arch/arm/mach-omap2/omap3/board.c | 21 +++++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-)