public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] sunxi: Remove some unnecessary #ifdefs
@ 2016-07-09 13:05 Hans de Goede
  2016-07-10  8:12 ` Ian Campbell
  0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2016-07-09 13:05 UTC (permalink / raw)
  To: u-boot

We always define CONFIG_MISC_INIT_R on sunxi and misc_init_r is never
called in the spl, so the linker will optimize it and parse_spl_header(),
of which it is the only caller, away.

On the tests I've done (Orange Pi PC build) the SPL actually becomes
8 bytes smaller with this patch.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 board/sunxi/board.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 955a44f..9767310 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -20,12 +20,14 @@
 #include <asm/arch/dram.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
+#include <asm/arch/spl.h>
 #include <asm/arch/usb_phy.h>
 #ifndef CONFIG_ARM64
 #include <asm/armv7.h>
 #endif
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <environment.h>
 #include <libfdt.h>
 #include <nand.h>
 #include <net.h>
@@ -572,10 +574,6 @@ void get_board_serial(struct tag_serialnr *serialnr)
 }
 #endif
 
-#if !defined(CONFIG_SPL_BUILD)
-#include <asm/arch/spl.h>
-#include <environment.h>
-
 /*
  * Check the SPL header for the "sunxi" variant. If found: parse values
  * that might have been passed by the loader ("fel" utility), and update
@@ -608,7 +606,6 @@ static void parse_spl_header(const uint32_t spl_addr)
 	/* otherwise assume .scr format (mkimage-type script) */
 	setenv_hex("fel_scriptaddr", spl->fel_script_address);
 }
-#endif
 
 static void setup_environment(const void *fdt)
 {
@@ -653,12 +650,10 @@ static void setup_environment(const void *fdt)
 	}
 }
 
-#ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
 	int ret;
 
-#if !defined(CONFIG_SPL_BUILD)
 	setenv("fel_booted", NULL);
 	setenv("fel_scriptaddr", NULL);
 	/* determine if we are running in FEL mode */
@@ -666,7 +661,6 @@ int misc_init_r(void)
 		setenv("fel_booted", "1");
 		parse_spl_header(SPL_ADDR);
 	}
-#endif
 
 	setup_environment(gd->fdt_blob);
 
@@ -679,7 +673,6 @@ int misc_init_r(void)
 
 	return 0;
 }
-#endif
 
 int ft_board_setup(void *blob, bd_t *bd)
 {
-- 
2.7.4

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

* [U-Boot] [PATCH] sunxi: Remove some unnecessary #ifdefs
  2016-07-09 13:05 [U-Boot] [PATCH] sunxi: Remove some unnecessary #ifdefs Hans de Goede
@ 2016-07-10  8:12 ` Ian Campbell
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2016-07-10  8:12 UTC (permalink / raw)
  To: u-boot

On Sat, 2016-07-09 at 15:05 +0200, Hans de Goede wrote:
> We always define CONFIG_MISC_INIT_R on sunxi and misc_init_r is never
> called in the spl, so the linker will optimize it and
> parse_spl_header(),
> of which it is the only caller, away.
> 
> On the tests I've done (Orange Pi PC build) the SPL actually becomes
> 8 bytes smaller with this patch.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

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

end of thread, other threads:[~2016-07-10  8:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-09 13:05 [U-Boot] [PATCH] sunxi: Remove some unnecessary #ifdefs Hans de Goede
2016-07-10  8:12 ` Ian Campbell

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