public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [RFC 6/7] bootstage: Eliminate when not enabled
Date: Mon,  3 May 2021 16:48:58 -0400	[thread overview]
Message-ID: <20210503204859.18756-7-trini@konsulko.com> (raw)
In-Reply-To: <20210503204859.18756-1-trini@konsulko.com>

When we do not have bootstage enabled, rather than include an empty
dummy function, we just don't reference it.  This saves us space in some
tight builds.  This also shows a few cases where show_boot_progress was
incorrectly guarded before.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Moving to gcc-11 causes at least one well maintained and used board to
now run out of space, and this saves us 400 bytes in SPL.
---
 arch/x86/cpu/cpu.c                    | 2 ++
 board/Seagate/dockstar/dockstar.c     | 2 ++
 board/Seagate/goflexhome/goflexhome.c | 2 ++
 board/bosch/shc/board.c               | 6 +++---
 board/buffalo/lsxl/lsxl.c             | 2 +-
 board/k+p/kp_imx53/kp_imx53.c         | 2 ++
 board/st/stv0991/stv0991.c            | 2 +-
 common/init/board_init.c              | 2 ++
 common/spl/spl.c                      | 2 ++
 include/bootstage.h                   | 4 +++-
 10 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 9c4edfcbfdaa..01dece5769c8 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -178,10 +178,12 @@ int default_print_cpuinfo(void)
 	return 0;
 }
 
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
 void show_boot_progress(int val)
 {
 	outb(val, POST_PORT);
 }
+#endif
 
 #if !defined(CONFIG_SYS_COREBOOT) && !defined(CONFIG_EFI_STUB)
 /*
diff --git a/board/Seagate/dockstar/dockstar.c b/board/Seagate/dockstar/dockstar.c
index 380e37be5502..fb6919315804 100644
--- a/board/Seagate/dockstar/dockstar.c
+++ b/board/Seagate/dockstar/dockstar.c
@@ -140,6 +140,7 @@ void reset_phy(void)
 }
 #endif /* CONFIG_RESET_PHY_R */
 
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
 #define GREEN_LED	(1 << 14)
 #define ORANGE_LED	(1 << 15)
 #define BOTH_LEDS	(GREEN_LED | ORANGE_LED)
@@ -169,3 +170,4 @@ void show_boot_progress(int val)
 		break;
 	}
 }
+#endif
diff --git a/board/Seagate/goflexhome/goflexhome.c b/board/Seagate/goflexhome/goflexhome.c
index 4c19fa7195e8..af8cab7bdc73 100644
--- a/board/Seagate/goflexhome/goflexhome.c
+++ b/board/Seagate/goflexhome/goflexhome.c
@@ -142,6 +142,7 @@ void reset_phy(void)
 }
 #endif /* CONFIG_RESET_PHY_R */
 
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
 #define GREEN_LED	(1 << 14)
 #define ORANGE_LED	(1 << 15)
 #define BOTH_LEDS	(GREEN_LED | ORANGE_LED)
@@ -175,3 +176,4 @@ void show_boot_progress(int val)
 		break;
 	}
 }
+#endif
diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c
index e89378188728..01d9ce4f71f9 100644
--- a/board/bosch/shc/board.c
+++ b/board/bosch/shc/board.c
@@ -188,7 +188,7 @@ static void __maybe_unused leds_set_booting(void)
 /*
  * Function to set the LEDs in the state "Bootloader error"
  */
-static void leds_set_failure(int state)
+static void __maybe_unused leds_set_failure(int state)
 {
 #if defined(CONFIG_B_SAMPLE)
 	/* Turn all blue and green LEDs off */
@@ -479,7 +479,7 @@ int board_eth_init(struct bd_info *bis)
 }
 #endif
 
-#ifdef CONFIG_SHOW_BOOT_PROGRESS
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
 static void bosch_check_reset_pin(void)
 {
 	if (readl(GPIO1_BASE + OMAP_GPIO_IRQSTATUS_SET_0) & RESET_MASK) {
@@ -525,9 +525,9 @@ void show_boot_progress(int val)
 		break;
 	}
 }
+#endif
 
 void arch_preboot_os(void)
 {
 	leds_set_finish();
 }
-#endif
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index 34be601fdde6..738b6bc25cea 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -271,7 +271,7 @@ int misc_init_r(void)
 }
 #endif
 
-#ifdef CONFIG_SHOW_BOOT_PROGRESS
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
 void show_boot_progress(int progress)
 {
 	if (progress > 0)
diff --git a/board/k+p/kp_imx53/kp_imx53.c b/board/k+p/kp_imx53/kp_imx53.c
index cc8118b4ad4f..7c3a695cb258 100644
--- a/board/k+p/kp_imx53/kp_imx53.c
+++ b/board/k+p/kp_imx53/kp_imx53.c
@@ -155,6 +155,7 @@ int board_late_init(void)
 	return ret;
 }
 
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
 #define GPIO_DR 0x0
 #define GPIO_GDIR 0x4
 #define GPIO_ALT1 0x1
@@ -203,3 +204,4 @@ void show_boot_progress(int status)
 		gpio_direction_output(LED_RED, 1);
 	}
 }
+#endif
diff --git a/board/st/stv0991/stv0991.c b/board/st/stv0991/stv0991.c
index 3b0de82db283..57ca9f659c16 100644
--- a/board/st/stv0991/stv0991.c
+++ b/board/st/stv0991/stv0991.c
@@ -37,7 +37,7 @@ U_BOOT_DRVINFO(stv09911_serials) = {
 };
 #endif
 
-#ifdef CONFIG_SHOW_BOOT_PROGRESS
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
 void show_boot_progress(int progress)
 {
 	printf("%i\n", progress);
diff --git a/common/init/board_init.c b/common/init/board_init.c
index 3f183ee11326..0965b96fa3ad 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -166,7 +166,9 @@ void board_init_f_init_reserve(ulong base)
 		board_init_f_init_stack_protection();
 }
 
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
 /*
  * Board-specific Platform code can reimplement show_boot_progress () if needed
  */
 __weak void show_boot_progress(int val) {}
+#endif
diff --git a/common/spl/spl.c b/common/spl/spl.c
index a0a608fd7725..eba77cace6df 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -58,10 +58,12 @@ binman_sym_declare(ulong, spl, size);
 /* Define board data structure */
 static struct bd_info bdata __attribute__ ((section(".data")));
 
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
 /*
  * Board-specific Platform code can reimplement show_boot_progress () if needed
  */
 __weak void show_boot_progress(int val) {}
+#endif
 
 #if defined(CONFIG_SPL_OS_BOOT) || CONFIG_IS_ENABLED(HANDOFF) || \
 	defined(CONFIG_SPL_ATF)
diff --git a/include/bootstage.h b/include/bootstage.h
index 00c85fb86aa2..f837a387c8c7 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -11,6 +11,8 @@
 #ifndef _BOOTSTAGE_H
 #define _BOOTSTAGE_H
 
+#include <linux/kconfig.h>
+
 /* Flags for each bootstage record */
 enum bootstage_flags {
 	BOOTSTAGEF_ERROR	= 1 << 0,	/* Error record */
@@ -218,7 +220,7 @@ enum bootstage_id {
  */
 ulong timer_get_boot_us(void);
 
-#if defined(USE_HOSTCC)
+#if defined(USE_HOSTCC) || !CONFIG_IS_ENABLED(BOOTSTAGE)
 #define show_boot_progress(val) do {} while (0)
 #else
 /**
-- 
2.17.1

  parent reply	other threads:[~2021-05-03 20:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 20:48 [RFC 0/7] Update CI to using GCC 11.0 / LLVM-11 Tom Rini
2021-05-03 20:48 ` [RFC 1/7] ARM: mvebu: a38x: Correct mismatched bound warnings Tom Rini
2021-07-07 17:33   ` Tom Rini
2021-07-14 20:52   ` Pali Rohár
2021-07-15  7:59     ` Stefan Roese
2021-07-15 13:07       ` [EXT] " Kostya Porotchkin
2021-05-03 20:48 ` [RFC 2/7] freescale: Drop unnecessary cpld_data_t non-typedef Tom Rini
2021-07-07 17:34   ` Tom Rini
2021-05-03 20:48 ` [RFC 3/7] eb_cpu5282: Declare diplay_width / display_height as externs Tom Rini
2021-07-07 17:34   ` Tom Rini
2021-05-03 20:48 ` [RFC 4/7] pinctrl: mscc: Fix multiple definition error Tom Rini
2021-05-04  7:51   ` Horatiu Vultur
2021-05-04 18:57   ` Daniel Schwierzeck
2021-07-07 17:34   ` Tom Rini
2021-05-03 20:48 ` [RFC 5/7] Makefile: Disable gcc-10.0 warnings Tom Rini
2021-07-07 17:34   ` Tom Rini
2021-05-03 20:48 ` Tom Rini [this message]
2021-07-07 17:34   ` [RFC 6/7] bootstage: Eliminate when not enabled Tom Rini
2021-05-03 20:48 ` [RFC 7/7] TEST: Move to gcc-11.0 prerelease and LLVM-11 Tom Rini
2021-06-16 19:58   ` [RFCv2] " Tom Rini
2021-06-16 20:00   ` [RFCv3] Azure/GitLab: Move to gcc-11.1.0 " Tom Rini
2021-06-17  8:27     ` Bin Meng
2021-06-17 12:31       ` Tom Rini
2021-06-17 14:09         ` Bin Meng
2021-06-17 14:14           ` Tom Rini
2021-06-17 14:24             ` Bin Meng
2021-06-17 14:45               ` Tom Rini
2021-06-17 14:51                 ` Bin Meng

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=20210503204859.18756-7-trini@konsulko.com \
    --to=trini@konsulko.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