[U-Boot] [PATCH 3/8] spl: Move the loading code into its own function
Masahiro Yamada
yamada.masahiro at socionext.com
Tue Nov 22 08:31:53 CET 2016
Hi Simon,
2016-11-18 2:29 GMT+09:00 Simon Glass <sjg at chromium.org>:
> Create a boot_from_devices() function to handle trying each device. This
> helps to reduce the size of the already-large board_init_r() function.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> common/spl/spl.c | 33 +++++++++++++++++++++------------
> 1 file changed, 21 insertions(+), 12 deletions(-)
>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 4f23c0e..8c3a47d 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -372,12 +372,29 @@ static int spl_load_image(struct spl_image_info *spl_image, u32 boot_device)
>
> bootdev.boot_device = boot_device;
> bootdev.boot_device_name = NULL;
> - if (loader)
> - return loader->load_image(spl_image, &bootdev);
>
> + return loader->load_image(spl_image, &bootdev);
> +}
> +
> +static int boot_from_devices(struct spl_image_info *spl_image,
> + u32 spl_boot_list[])
> +{
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(spl_boot_list) &&
> + spl_boot_list[i] != BOOT_DEVICE_NONE; i++) {
> + struct spl_image_loader *loader;
> +
> + announce_boot_device(spl_boot_list[i]);
> + loader = spl_ll_find_loader(spl_boot_list[i]);
I do not believe ARRAY_SIZE(spl_boot_list) would work
in this context.
--
Best Regards
Masahiro Yamada
More information about the U-Boot
mailing list