All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karl Apsite <Karl.Apsite@dornerworks.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 2/3] Combine bootm_find_<thing> functions together
Date: Fri, 15 May 2015 16:17:35 -0400	[thread overview]
Message-ID: <5556545F.50201@dornerworks.com> (raw)
In-Reply-To: <CAPnjgZ0JrVzUzkr2wYL9TJNCiEkSWBr3wZHfdkVG5CSRH1vhzg@mail.gmail.com>



On 05/15/2015 09:57 AM, Simon Glass wrote:
> Hi Karl,
> 
> On 13 May 2015 at 06:53, Karl Apsite <Karl.Apsite@dornerworks.com> wrote:
>> bootm_find_ramdisk_fdt() renamed to bootm_find_images() for readability.
>>
>> The function bootm_find_ramdisk_fdt() appears to be a simple wrapper for
>> bootm_find_ramdisk(), bootm_find_fdt(), and now bootm_find_loadables().
>> I didn't see any other callers entering a bootm_find<thing>, so removing
>> the wrapper, and condensing these together hopefully makes the code a
>> little simpler.
>>
>> Signed-off-by: Karl Apsite <Karl.Apsite@dornerworks.com>
>> ---
>>
>>  common/bootm.c     | 37 ++-----------------------------------
>>  common/cmd_bootm.c |  4 ++--
>>  include/bootm.h    |  2 +-
>>  3 files changed, 5 insertions(+), 38 deletions(-)
>>
>> diff --git a/common/bootm.c b/common/bootm.c
>> index f04e49b..ae0d674 100644
>> --- a/common/bootm.c
>> +++ b/common/bootm.c
>> @@ -206,7 +206,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
>>         return 0;
>>  }
>>
>> -static int bootm_find_ramdisk(int flag, int argc, char * const argv[])
>> +int bootm_find_images(int flag, int argc, char * const argv[])
>>  {
>>         int ret;
>>
>> @@ -218,14 +218,7 @@ static int bootm_find_ramdisk(int flag, int argc, char * const argv[])
>>                 return 1;
>>         }
>>
>> -       return 0;
>> -}
>> -
>>  #if defined(CONFIG_OF_LIBFDT)
>> -static int bootm_find_fdt(int flag, int argc, char * const argv[])
>> -{
>> -       int ret;
>> -
>>         /* find flattened device tree */
>>         ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images,
>>                            &images.ft_addr, &images.ft_len);
>> @@ -233,18 +226,10 @@ static int bootm_find_fdt(int flag, int argc, char * const argv[])
>>                 puts("Could not find a valid device tree\n");
>>                 return 1;
>>         }
>> -
>>         set_working_fdt_addr((ulong)images.ft_addr);
>> -
>> -       return 0;
>> -}
>>  #endif
>>
>>  #if defined(CONFIG_FIT)
>> -static int bootm_find_loadables(int flag, int argc, char * const argv[])
>> -{
>> -       int ret;
>> -
>>         /* find all of the loadables */
>>         ret = boot_get_loadable(argc, argv, &images, IH_ARCH_DEFAULT,
>>                                NULL, NULL);
>> @@ -252,24 +237,6 @@ static int bootm_find_loadables(int flag, int argc, char * const argv[])
>>                 puts("Loadable(s) is corrupt or invalid\n");
>>                 return 1;
>>         }
>> -
>> -       return 0;
>> -}
>> -#endif
>> -
>> -int bootm_find_ramdisk_fdt(int flag, int argc, char * const argv[])
>> -{
>> -       if (bootm_find_ramdisk(flag, argc, argv))
>> -               return 1;
>> -
>> -#if defined(CONFIG_OF_LIBFDT)
>> -       if (bootm_find_fdt(flag, argc, argv))
>> -               return 1;
>> -#endif
>> -
>> -#if defined(CONFIG_FIT)
>> -       if (bootm_find_loadables(flag, argc, argv))
>> -               return 1;
>>  #endif
>>
>>         return 0;
>> @@ -283,7 +250,7 @@ static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int argc,
>>              (images.os.type == IH_TYPE_MULTI)) &&
>>             (images.os.os == IH_OS_LINUX ||
>>                  images.os.os == IH_OS_VXWORKS))
>> -               return bootm_find_ramdisk_fdt(flag, argc, argv);
>> +               return bootm_find_images(flag, argc, argv);
>>
>>         return 0;
>>  }
>> diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
>> index 6b6aca6..48738ac 100644
>> --- a/common/cmd_bootm.c
>> +++ b/common/cmd_bootm.c
>> @@ -580,7 +580,7 @@ static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc,
>>          * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
>>          * have a header that provide this informaiton.
>>          */
>> -       if (bootm_find_ramdisk_fdt(flag, argc, argv))
>> +       if (bootm_find_images(flag, argc, argv))
>>                 return 1;
>>
>>         return 0;
>> @@ -721,7 +721,7 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
>>          * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
>>          * have a header that provide this informaiton.
>>          */
>> -       if (bootm_find_ramdisk_fdt(flag, argc, argv))
>> +       if (bootm_find_images(flag, argc, argv))
>>                 return 1;
>>
>>         return 0;
>> diff --git a/include/bootm.h b/include/bootm.h
>> index 6181488..4981377 100644
>> --- a/include/bootm.h
>> +++ b/include/bootm.h
>> @@ -49,7 +49,7 @@ int boot_selected_os(int argc, char * const argv[], int state,
>>  ulong bootm_disable_interrupts(void);
>>
>>  /* This is a special function used by booti/bootz */
> 
>> -int bootm_find_ramdisk_fdt(int flag, int argc, char * const argv[]);
>> +int bootm_find_images(int flag, int argc, char * const argv[]);
> 
> Can you please add a proper functoin comment for this function?
> Parameters, what it does, return value etc...
> 
Sure thing.

>>
>>  int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
>>                     int states, bootm_headers_t *images, int boot_progress);
>> --
>> 2.3.7
>>
> 
> Regards,
> Simon
> 

  reply	other threads:[~2015-05-15 20:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 12:53 [U-Boot] [PATCH v1 0/3] New tag for Flattened Image Trees (FIT) - Booting Xen from a FIT Karl Apsite
2015-05-13 12:53 ` [U-Boot] [PATCH v1 1/3] add boot_get_loadables() to load listed images Karl Apsite
2015-05-15 13:57   ` Simon Glass
2015-05-15 20:17     ` Karl Apsite
2015-05-15 20:38       ` Simon Glass
2015-05-13 12:53 ` [U-Boot] [PATCH v1 2/3] Combine bootm_find_<thing> functions together Karl Apsite
2015-05-15 13:57   ` Simon Glass
2015-05-15 20:17     ` Karl Apsite [this message]
2015-05-13 12:54 ` [U-Boot] [PATCH v1 3/3] Remove the bootm_find_other() wrapper Karl Apsite
2015-05-15 13:58   ` Simon Glass
2015-05-15 13:58     ` Simon Glass
2015-05-15 14:33 ` [U-Boot] [PATCH v1 0/3] New tag for Flattened Image Trees (FIT) - Booting Xen from a FIT Karl Apsite
2015-05-15 14:52   ` 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=5556545F.50201@dornerworks.com \
    --to=karl.apsite@dornerworks.com \
    --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.