From: Michal Simek <monstr@monstr.eu>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 4/8] main: Use autoconf to remove #ifdefs around process_boot_delay()
Date: Mon, 28 Oct 2013 15:19:13 +0100 [thread overview]
Message-ID: <526E7261.3030402@monstr.eu> (raw)
In-Reply-To: <1371480300-30274-5-git-send-email-sjg@chromium.org>
On 06/17/2013 04:44 PM, Simon Glass wrote:
> Use autoconf to make process_boot_delay() be compiled always, and adjust
> the caller and related functions as needed.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> Changes in v4:
> - Split out new patch to remove #ifdefs around process_boot_delay()
>
> Changes in v3: None
> Changes in v2: None
>
> common/main.c | 71 ++++++++++++++++++++++++++---------------------------------
> 1 file changed, 31 insertions(+), 40 deletions(-)
>
> diff --git a/common/main.c b/common/main.c
> index 3a4754d..dba6cee 100644
> --- a/common/main.c
> +++ b/common/main.c
> @@ -79,8 +79,6 @@ extern void mdm_init(void); /* defined in board.c */
> * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
> * returns: 0 - no key string, allow autoboot 1 - got key string, abort
> */
> -#if defined(CONFIG_BOOTDELAY)
> -# if defined(CONFIG_AUTOBOOT_KEYED)
> static int abortboot_keyed(int bootdelay)
> {
> int abort = 0;
> @@ -173,8 +171,6 @@ static int abortboot_keyed(int bootdelay)
> return abort;
> }
>
> -# else /* !defined(CONFIG_AUTOBOOT_KEYED) */
> -
> static int menukey;
>
> static int abortboot_normal(int bootdelay)
> @@ -228,17 +224,14 @@ static int abortboot_normal(int bootdelay)
>
> return abort;
> }
> -# endif /* CONFIG_AUTOBOOT_KEYED */
>
> static int abortboot(int bootdelay)
> {
> -#ifdef CONFIG_AUTOBOOT_KEYED
> - return abortboot_keyed(bootdelay);
> -#else
> - return abortboot_normal(bootdelay);
> -#endif
> + if (autoconf_autoboot_keyed())
> + return abortboot_keyed(bootdelay);
> + else
> + return abortboot_normal(bootdelay);
> }
> -#endif /* CONFIG_BOOTDELAY */
>
> /*
> * Runs the given boot command securely. Specifically:
> @@ -254,7 +247,6 @@ static int abortboot(int bootdelay)
> * printing the error message to console.
> */
>
> -#if defined(CONFIG_BOOTDELAY) && defined(CONFIG_OF_CONTROL)
> static void secure_boot_cmd(char *cmd)
> {
> cmd_tbl_t *cmdtp;
> @@ -295,22 +287,21 @@ static void process_fdt_options(const void *blob)
>
> /* Add an env variable to point to a kernel payload, if available */
> addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0);
> - if (addr)
> - setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
> + if (addr) {
> + setenv_addr("kernaddr",
> + (void *)(autoconf_sys_text_base() + addr));
> + }
>
> /* Add an env variable to point to a root disk, if available */
> addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
> - if (addr)
> - setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
> + if (addr) {
> + setenv_addr("rootaddr",
> + (void *)(autoconf_sys_text_base() + addr));
> + }
> }
> -#endif /* CONFIG_OF_CONTROL */
>
> -#ifdef CONFIG_BOOTDELAY
> static void process_boot_delay(void)
> {
> -#ifdef CONFIG_OF_CONTROL
> - char *env;
> -#endif
> char *s;
> int bootdelay;
> #ifdef CONFIG_BOOTCOUNT_LIMIT
> @@ -327,7 +318,7 @@ static void process_boot_delay(void)
> #endif /* CONFIG_BOOTCOUNT_LIMIT */
>
> s = getenv ("bootdelay");
> - bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
> + bootdelay = s ? (int)simple_strtol(s, NULL, 10) : autoconf_bootdelay();
>
> #ifdef CONFIG_OF_CONTROL
> bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay",
> @@ -357,23 +348,24 @@ static void process_boot_delay(void)
> else
> #endif /* CONFIG_BOOTCOUNT_LIMIT */
> s = getenv ("bootcmd");
> -#ifdef CONFIG_OF_CONTROL
> - /* Allow the fdt to override the boot command */
> - env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd");
> - if (env)
> - s = env;
> + if (autoconf_of_control()) {
> + char *env;
>
> - process_fdt_options(gd->fdt_blob);
> + /* Allow the fdt to override the boot command */
> + env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd");
> + if (env)
> + s = env;
>
> - /*
> - * If the bootsecure option was chosen, use secure_boot_cmd().
> - * Always use 'env' in this case, since bootsecure requres that the
> - * bootcmd was specified in the FDT too.
> - */
> - if (fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0))
> - secure_boot_cmd(env);
> + process_fdt_options(gd->fdt_blob);
>
> -#endif /* CONFIG_OF_CONTROL */
> + /*
> + * If the bootsecure option was chosen, use secure_boot_cmd().
> + * Always use 'env' in this case, since bootsecure requres that
> + * the bootcmd was specified in the FDT too.
> + */
This indentation doesn't look good to me.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131028/84c268eb/attachment.pgp>
next prev parent reply other threads:[~2013-10-28 14:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-17 14:44 [U-Boot] [PATCH v4 0/8] Provide a mechanism to avoid using #ifdef everywhere Simon Glass
2013-06-17 14:44 ` [U-Boot] [PATCH v4 1/8] Implement autoconf header file Simon Glass
2013-06-17 14:44 ` [U-Boot] [PATCH v4 2/8] main: Use autoconf for boot retry feature Simon Glass
2013-06-17 14:44 ` [U-Boot] [PATCH v4 3/8] main: Remove CONFIG #ifdefs from the abortboot() code Simon Glass
2013-06-17 14:44 ` [U-Boot] [PATCH v4 4/8] main: Use autoconf to remove #ifdefs around process_boot_delay() Simon Glass
2013-10-28 14:19 ` Michal Simek [this message]
2013-06-17 14:44 ` [U-Boot] [PATCH v4 5/8] main: Use autoconf for boot_delay code Simon Glass
2013-06-17 14:44 ` [U-Boot] [PATCH v4 6/8] main: Use autoconf for parser selection Simon Glass
2013-06-17 14:44 ` [U-Boot] [PATCH v4 7/8] main: Use autoconf in command line reading Simon Glass
2013-06-17 14:45 ` [U-Boot] [PATCH v4 8/8] main: Use autoconf in main_loop() Simon Glass
2013-06-23 7:29 ` [U-Boot] [PATCH v4 0/8] Provide a mechanism to avoid using #ifdef everywhere Albert ARIBAUD
2013-06-25 0:52 ` Simon Glass
2013-06-27 7:04 ` Albert ARIBAUD
2013-06-27 7:15 ` Simon Glass
-- strict thread matches above, loose matches on Subject: below --
2013-10-26 15:14 Simon Glass
2013-10-26 15:14 ` [U-Boot] [PATCH v4 4/8] main: Use autoconf to remove #ifdefs around process_boot_delay() Simon Glass
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=526E7261.3030402@monstr.eu \
--to=monstr@monstr.eu \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.