diff mbox

[U-Boot] env: don't generate callback list entries for SPL

Message ID 20121215005405.GA8363@buserror.net
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Scott Wood Dec. 15, 2012, 12:54 a.m. UTC
SPL doesn't use the environment.  These list entries prevent the
functions from being garbage-collected, even though nothing will look at
the list.  This caused several SPL builds (e.g. P2020RDB-PC_NAND) to
break due to size limitations.

A static inline function is used to provide a context in which we
can consume the callback, and thus avoid unused function warnings.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 include/env_callback.h |    8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Joe Hershberger Dec. 15, 2012, 7:04 a.m. UTC | #1
Hi Scott,

On Fri, Dec 14, 2012 at 6:54 PM, Scott Wood <scottwood@freescale.com> wrote:
> SPL doesn't use the environment.  These list entries prevent the
> functions from being garbage-collected, even though nothing will look at
> the list.  This caused several SPL builds (e.g. P2020RDB-PC_NAND) to
> break due to size limitations.
>
> A static inline function is used to provide a context in which we
> can consume the callback, and thus avoid unused function warnings.
>
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Sorry about that.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Tom Rini Dec. 17, 2012, 2:52 p.m. UTC | #2
On Fri, Dec 14, 2012 at 06:54:05PM -0600, Scott Wood wrote:

> SPL doesn't use the environment.  These list entries prevent the
> functions from being garbage-collected, even though nothing will look at
> the list.  This caused several SPL builds (e.g. P2020RDB-PC_NAND) to
> break due to size limitations.

SPL with networking support uses the environment, so you need to toss
CONFIG_SPL_NET_SUPPORT into the test.  That said, it's not an
interactive environment and this might push that area over the size
limit too (in the USB case, which is already pretty tight).
diff mbox

Patch

diff --git a/include/env_callback.h b/include/env_callback.h
index 47fdc6f..c583120 100644
--- a/include/env_callback.h
+++ b/include/env_callback.h
@@ -68,8 +68,16 @@  void env_callback_init(ENTRY *var_entry);
  * when associated through the ".callbacks" environment variable, the callback
  * will be executed any time the variable is inserted, overwritten, or deleted.
  */
+#ifdef CONFIG_SPL_BUILD
+#define U_BOOT_ENV_CALLBACK(name, callback) \
+	static inline void _u_boot_env_noop_##name(void) \
+	{ \
+		(void)callback; \
+	}
+#else
 #define U_BOOT_ENV_CALLBACK(name, callback) \
 	ll_entry_declare(struct env_clbk_tbl, name, env_clbk, env_clbk) = \
 	{#name, callback}
+#endif
 
 #endif /* __ENV_CALLBACK_H__ */