summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-07-20 20:51:28 -0600
committerTom Rini <trini@konsulko.com>2019-08-02 11:19:14 -0400
commit5ec35ff3eb4598f93e349ea9a4fd56b700c1a3c3 (patch)
tree9257904259608b0d8d2baeb494077cd8c54bf00f
parent5fa3fd25ed600694ba62488aa646dcec14bf4bbe (diff)
downloadu-boot-5ec35ff3eb4598f93e349ea9a4fd56b700c1a3c3.tar.gz
u-boot-5ec35ff3eb4598f93e349ea9a4fd56b700c1a3c3.tar.bz2
u-boot-5ec35ff3eb4598f93e349ea9a4fd56b700c1a3c3.zip
autoboot: Adjust the implementation in autoboot_command()
Avoid use of #ifdef and keep the common condion in a variable. This makes the code easier to read. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--common/autoboot.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/common/autoboot.c b/common/autoboot.c
index 75132f8697..42fbd7614a 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -349,15 +349,18 @@ void autoboot_command(const char *s)
debug("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
if (stored_bootdelay != -1 && s && !abortboot(stored_bootdelay)) {
-#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
- int prev = disable_ctrlc(1); /* disable Control C checking */
-#endif
+ bool lock;
+ int prev;
+
+ lock = IS_ENABLED(CONFIG_AUTOBOOT_KEYED) &&
+ !IS_ENABLED(CONFIG_AUTOBOOT_KEYED_CTRLC);
+ if (lock)
+ prev = disable_ctrlc(1); /* disable Ctrl-C checking */
run_command_list(s, -1, 0);
-#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
- disable_ctrlc(prev); /* restore Control C checking */
-#endif
+ if (lock)
+ disable_ctrlc(prev); /* restore Ctrl-C checking */
}
if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY) &&