diff mbox series

[1/4] env: remove callback.o for an SPL build

Message ID 20200227135600.28853-2-rasmus.villemoes@prevas.dk
State Accepted
Commit e13df08a2685345f12ae1ec1d99ea3f599d58360
Headers show
Series remove (more) env callback code for SPL | expand

Commit Message

Rasmus Villemoes Feb. 27, 2020, 1:56 p.m. UTC
env.h says this about about callback declarations (U_BOOT_ENV_CALLBACK):

 * For SPL these are silently dropped to reduce code size, since environment
 * callbacks are not supported with SPL.

So env_callback_init() does a lot of work to not find anything in the
guaranteed empty env_clbk list. Drop callback.o entirely from the link
and stub out the only public function defined in callback.o. This cuts
about 600 bytes from the SPL on my ppc build.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
---
 env/Makefile           | 2 +-
 include/env_callback.h | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Simon Glass Feb. 27, 2020, 11:40 p.m. UTC | #1
On Thu, 27 Feb 2020 at 05:56, Rasmus Villemoes
<rasmus.villemoes at prevas.dk> wrote:
>
> env.h says this about about callback declarations (U_BOOT_ENV_CALLBACK):
>
>  * For SPL these are silently dropped to reduce code size, since environment
>  * callbacks are not supported with SPL.
>
> So env_callback_init() does a lot of work to not find anything in the
> guaranteed empty env_clbk list. Drop callback.o entirely from the link
> and stub out the only public function defined in callback.o. This cuts
> about 600 bytes from the SPL on my ppc build.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> ---
>  env/Makefile           | 2 +-
>  include/env_callback.h | 6 ++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>
Tom Rini April 24, 2020, 5:08 p.m. UTC | #2
On Thu, Feb 27, 2020 at 01:56:10PM +0000, Rasmus Villemoes wrote:

> env.h says this about about callback declarations (U_BOOT_ENV_CALLBACK):
> 
>  * For SPL these are silently dropped to reduce code size, since environment
>  * callbacks are not supported with SPL.
> 
> So env_callback_init() does a lot of work to not find anything in the
> guaranteed empty env_clbk list. Drop callback.o entirely from the link
> and stub out the only public function defined in callback.o. This cuts
> about 600 bytes from the SPL on my ppc build.
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> Reviewed-by: Simon Glass <sjg at chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/env/Makefile b/env/Makefile
index e2a165b8f1..c4ad654328 100644
--- a/env/Makefile
+++ b/env/Makefile
@@ -7,9 +7,9 @@  obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += common.o
 obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += env.o
 obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += attr.o
 obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += flags.o
-obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += callback.o
 
 ifndef CONFIG_SPL_BUILD
+obj-y += callback.o
 obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
 extra-$(CONFIG_ENV_IS_EMBEDDED) += embedded.o
 obj-$(CONFIG_ENV_IS_IN_EEPROM) += embedded.o
diff --git a/include/env_callback.h b/include/env_callback.h
index 74da20eec3..05e9516a0f 100644
--- a/include/env_callback.h
+++ b/include/env_callback.h
@@ -72,6 +72,12 @@ 
 	"serial#:serialno," \
 	CONFIG_ENV_CALLBACK_LIST_STATIC
 
+#ifndef CONFIG_SPL_BUILD
 void env_callback_init(struct env_entry *var_entry);
+#else
+static inline void env_callback_init(struct env_entry *var_entry)
+{
+}
+#endif
 
 #endif /* __ENV_CALLBACK_H__ */