]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spl: Pass the loader into spl_load_image()
authorSimon Glass <sjg@chromium.org>
Wed, 30 Nov 2016 22:30:52 +0000 (15:30 -0700)
committerTom Rini <trini@konsulko.com>
Fri, 9 Dec 2016 13:40:15 +0000 (08:40 -0500)
Rather than have this function figure out the correct loader again, pass
it in as a parameter.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/spl/spl.c

index 80c85adb0a75274b25d74860c279cf96a87d4d40..435534bff811dacee97d492ee8e312971f69cfb8 100644 (file)
@@ -367,12 +367,12 @@ static struct spl_image_loader *spl_ll_find_loader(uint boot_device)
        return NULL;
 }
 
-static int spl_load_image(struct spl_image_info *spl_image, u32 boot_device)
+static int spl_load_image(struct spl_image_info *spl_image,
+                         struct spl_image_loader *loader)
 {
        struct spl_boot_device bootdev;
-       struct spl_image_loader *loader = spl_ll_find_loader(boot_device);
 
-       bootdev.boot_device = boot_device;
+       bootdev.boot_device = loader->boot_device;
        bootdev.boot_device_name = NULL;
 
        return loader->load_image(spl_image, &bootdev);
@@ -400,7 +400,7 @@ static int boot_from_devices(struct spl_image_info *spl_image,
                if (!loader)
                        puts("SPL: Unsupported Boot Device!\n");
 #endif
-               if (loader && !spl_load_image(spl_image, spl_boot_list[i]))
+               if (loader && !spl_load_image(spl_image, loader))
                        return 0;
        }