spl: Pass spl_image as a parameter to load_image() methods
Rather than having a global variable, pass the spl_image as a parameter.
This avoids BSS use, and makes it clearer what the function is actually
doing.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 84c8034..fae3dbc 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -185,7 +185,8 @@
return count;
}
-static int spl_ram_load_image(struct spl_boot_device *bootdev)
+static int spl_ram_load_image(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev)
{
struct image_header *header;
@@ -215,7 +216,7 @@
header = (struct image_header *)
(CONFIG_SYS_TEXT_BASE - sizeof(struct image_header));
- spl_parse_image_header(&spl_image, header);
+ spl_parse_image_header(spl_image, header);
}
return 0;
@@ -381,7 +382,7 @@
bootdev.boot_device = boot_device;
bootdev.boot_device_name = NULL;
if (loader)
- return loader->load_image(&bootdev);
+ return loader->load_image(&spl_image, &bootdev);
#if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
puts("SPL: Unsupported Boot Device!\n");