[PATCH 07/45] spl: Refactor controls for console output
Simon Glass
sjg at chromium.org
Sun Sep 25 17:02:10 CEST 2022
The expression in boot_from_devices() is fairly long. Move it into a
function with a suitable comment.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
common/spl/spl.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index edf24b05162..e7f16a18228 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -659,6 +659,18 @@ static int spl_load_image(struct spl_image_info *spl_image,
return ret;
}
+/**
+ * spl_show_output() - Selects whether to show info output in SPL
+ *
+ * Returns: true if info output should be shown, false if not
+ */
+static inline bool spl_show_output(void)
+{
+ return CONFIG_IS_ENABLED(SERIAL) &&
+ CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) &&
+ !IS_ENABLED(CONFIG_SILENT_CONSOLE);
+}
+
/**
* boot_from_devices() - Try loading a booting U-Boot from a list of devices
*
@@ -682,9 +694,7 @@ static int boot_from_devices(struct spl_image_info *spl_image,
if (CONFIG_IS_ENABLED(SHOW_ERRORS))
ret = -ENXIO;
loader = spl_ll_find_loader(bootdev);
- if (CONFIG_IS_ENABLED(SERIAL) &&
- CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) &&
- !IS_ENABLED(CONFIG_SILENT_CONSOLE)) {
+ if (spl_show_output()) {
if (loader)
printf("Trying to boot from %s\n",
spl_loader_name(loader));
--
2.37.3.998.g577e59143f-goog
More information about the U-Boot
mailing list