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_ymodem.c b/common/spl/spl_ymodem.c
index 168b951..8fbf895 100644
--- a/common/spl/spl_ymodem.c
+++ b/common/spl/spl_ymodem.c
@@ -68,7 +68,8 @@
return size;
}
-static int spl_ymodem_load_image(struct spl_boot_device *bootdev)
+static int spl_ymodem_load_image(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev)
{
int size = 0;
int err;
@@ -108,12 +109,12 @@
while ((res = xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0)
size += res;
} else {
- spl_parse_image_header(&spl_image, (struct image_header *)buf);
- ret = spl_parse_image_header(&spl_image,
+ spl_parse_image_header(spl_image, (struct image_header *)buf);
+ ret = spl_parse_image_header(spl_image,
(struct image_header *)buf);
if (ret)
return ret;
- addr = spl_image.load_addr;
+ addr = spl_image->load_addr;
memcpy((void *)addr, buf, res);
size += res;
addr += res;