[U-Boot] [RFC PATCH v2 12/15] main: Use autoconf in main_loop()

Joe Hershberger joe.hershberger at gmail.com
Wed Feb 27 10:21:16 CET 2013


Hi Simon,

On Mon, Feb 25, 2013 at 11:50 PM, Simon Glass <sjg at chromium.org> wrote:
> Hi Joe,
>
> On Sun, Feb 24, 2013 at 1:33 PM, Joe Hershberger
> <joe.hershberger at gmail.com> wrote:
>> Hi Simon,
>>
>> On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass <sjg at chromium.org> wrote:
>>> Convert main_loop() over to use autoconf, and add a required prototype
>>> to common.h.
>>>
>>> The do_mdm_init variable is now always defined, but this seems like an
>>> acceptable compromise.
>>>
>>> In fdt_support.h the #ifdef used is CONFIG_OF_LIBFDT. However, even if
>>> this is not defined we want to make the functions available for our
>>> conditional-compilation scheme. The only place where we really don't
>>> have access to these support functions is when USE_HOSTCC is defined.
>>> So change the #ifdef to that.
>>>
>>> Signed-off-by: Simon Glass <sjg at chromium.org>
>>> ---
>>> Changes in v2: None
>>>
>>>  common/main.c         | 77 +++++++++++++++++++++++----------------------------
>>>  include/common.h      |  1 +
>>>  include/fdt_support.h |  4 +--
>>>  3 files changed, 37 insertions(+), 45 deletions(-)
>>>
>>> diff --git a/common/main.c b/common/main.c
>>> index 3966321..40a79b7 100644
>>> --- a/common/main.c
>>> +++ b/common/main.c
>>> @@ -63,10 +63,7 @@ static int      retry_time = -1; /* -1 so can call readline before main_loop */
>>>
>>>  #define        endtick(seconds) (get_ticks() + (uint64_t)(seconds) * get_tbclk())
>>>
>>> -#ifdef CONFIG_MODEM_SUPPORT
>>>  int do_mdm_init = 0;
>>> -extern void mdm_init(void); /* defined in board.c */
>>> -#endif
>>>
>>>  /***************************************************************************
>>>   * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
>>> @@ -383,51 +380,47 @@ void main_loop(void)
>>>         int len;
>>>         int rc = 1;
>>>         int flag;
>>> -#ifdef CONFIG_PREBOOT
>>> -       char *p;
>>> -#endif
>>>
>>>         bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
>>>
>>> -#ifdef CONFIG_MODEM_SUPPORT
>>> -       debug("DEBUG: main_loop:   do_mdm_init=%d\n", do_mdm_init);
>>> -       if (do_mdm_init) {
>>> -               char *str = strdup(getenv("mdm_cmd"));
>>> -               setenv("preboot", str);  /* set or delete definition */
>>> -               if (str != NULL)
>>> -                       free(str);
>>> -               mdm_init(); /* wait for modem connection */
>>> +       if (autoconf_modem_support()) {
>>
>> Why not just remove do_mdm_init and use gd->do_mdm_init here?
>
> Would that be valid? There is board code to set that - I am not sure
> what the intent is but it seems beyond the scope of this patch to
> change it.



More information about the U-Boot mailing list