public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] env: don't generate callback list entries for SPL
Date: Thu, 20 Dec 2012 15:51:05 -0600	[thread overview]
Message-ID: <20121220215105.GA16627@buserror.net> (raw)

SPL doesn't write to 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 and/or unresolved symbols.

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>
Acked-by: Joe Hershberger <joe.hershberger@gmail.com>
---
v2: Update commit message to reflect that some SPLs do use the
environment, in a read-only fashion.  Also update commit message
to indicate that the size of the included functions wasn't the only
problem seen.
---
 include/env_callback.h |    8 ++++++++
 1 file changed, 8 insertions(+)

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__ */
-- 
1.7.9.5

             reply	other threads:[~2012-12-20 21:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-20 21:51 Scott Wood [this message]
2012-12-20 22:49 ` [U-Boot] [PATCH v2] env: don't generate callback list entries for SPL Kim Phillips
2012-12-22 15:19   ` Tom Rini
2013-03-08 20:27 ` [U-Boot] [U-Boot, " Tom Rini
2013-03-08 20:34   ` Scott Wood
2013-03-08 20:59     ` Tom Rini
2013-03-09  0:35       ` Scott Wood
2013-03-12 15:30         ` Tom Rini
2013-03-12 16:55           ` Scott Wood
2013-03-12 17:02             ` Tom Rini
2013-03-12 17:06               ` Scott Wood
2013-03-12 17:19                 ` Albert ARIBAUD
2013-03-12 17:47                   ` Tom Rini
2013-03-12 22:07                     ` Albert ARIBAUD
2013-03-13 18:40                       ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121220215105.GA16627@buserror.net \
    --to=scottwood@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox