[U-Boot] [RFC PATCH v2 04/15] main: Separate out the two abortboot() functions

Joe Hershberger joe.hershberger at gmail.com
Sun Feb 24 21:13:23 CET 2013


Hi Simon,

On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass <sjg at chromium.org> wrote:
> There are two implementations of autoboot(). Turn these into two separate
> functions, and create a single autoboot() which calls either one or the
> other.
>
> Also it seems that nothing uses autoboot() outside main, so make it static.

You say "autoboot" in this change log, but I think you mean to say "abortboot".

>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> Changes in v2: None
>
>  common/main.c    | 22 ++++++++++------------
>  include/common.h |  3 ---
>  2 files changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/common/main.c b/common/main.c
> index 2b8af2c..1e12e55 100644
> --- a/common/main.c
> +++ b/common/main.c
> @@ -92,11 +92,7 @@ extern void mdm_init(void); /* defined in board.c */
>   * returns: 0 -  no key string, allow autoboot 1 - got key string, abort
>   */
>  #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
> -# if defined(CONFIG_AUTOBOOT_KEYED)
> -#ifndef CONFIG_MENU
> -static inline
> -#endif
> -int abortboot(int bootdelay)
> +static int abortboot_keyed(int bootdelay)
>  {
>         int abort = 0;
>         uint64_t etime = endtick(bootdelay);
> @@ -209,16 +205,11 @@ int abortboot(int bootdelay)
>         return abort;
>  }
>
> -# else /* !defined(CONFIG_AUTOBOOT_KEYED) */
> -
>  #ifdef CONFIG_MENUKEY
>  static int menukey = 0;
>  #endif
>
> -#ifndef CONFIG_MENU
> -static inline
> -#endif
> -int abortboot(int bootdelay)
> +static int abortboot_normal(int bootdelay)
>  {
>         int abort = 0;
>         unsigned long ts;
> @@ -274,7 +265,14 @@ int abortboot(int bootdelay)
>
>         return abort;
>  }
> -# endif        /* CONFIG_AUTOBOOT_KEYED */
> +
> +static int abortboot(int bootdelay)
> +{
> +       if (autoconf_autoboot_keyed())
> +               return abortboot_keyed(bootdelay);
> +       else
> +               return abortboot_normal(bootdelay);
> +}
>  #endif /* CONFIG_BOOTDELAY >= 0  */
>
>  /*
> diff --git a/include/common.h b/include/common.h
> index 491783b..fb219fd 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -297,9 +297,6 @@ int readline_into_buffer(const char *const prompt, char *buffer,
>  int    parse_line (char *, char *[]);
>  void   init_cmd_timeout(void);
>  void   reset_cmd_timeout(void);
> -#ifdef CONFIG_MENU
> -int    abortboot(int bootdelay);
> -#endif

Is CONFIG_MENU gone at this point?  Does it no longer reference abortboot()?

>  extern char console_buffer[];
>
>  /* arch/$(ARCH)/lib/board.c */
> --
> 1.8.1.3
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


Reviewed-by: Joe Hershberger <joe.hershberger at ni.com>


More information about the U-Boot mailing list