diff mbox series

[U-Boot,3/5] tools: socfpga: Stop using global struct socfpga_image

Message ID 20180415133704.18950-3-marex@denx.de
State Accepted
Commit 9f0021a50b5a39a01f2ab3095a952a255660eb3f
Delegated to: Marek Vasut
Headers show
Series [U-Boot,1/5] ARM: socfpga: Add boot trampoline for Arria10 | expand

Commit Message

Marek Vasut April 15, 2018, 1:37 p.m. UTC
The structure is passed around correctly, create local instances
where necessary and zap the global struct socfpga_image instance.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Chin Liang See <chin.liang.see@intel.com>
---
 tools/socfpgaimage.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

See, Chin Liang April 17, 2018, 8:43 a.m. UTC | #1
On Sun, 2018-04-15 at 15:37 +0200, Marek Vasut wrote:
> The structure is passed around correctly, create local instances
> where necessary and zap the global struct socfpga_image instance.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Dinh Nguyen <dinguyen@kernel.org>
> Cc: Chin Liang See <chin.liang.see@intel.com>
> ---
>  tools/socfpgaimage.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 

Acked-by: Chin Liang See <chin.liang.see@intel.com>
diff mbox series

Patch

diff --git a/tools/socfpgaimage.c b/tools/socfpgaimage.c
index 8fe91fe80e..d77459cfed 100644
--- a/tools/socfpgaimage.c
+++ b/tools/socfpgaimage.c
@@ -46,14 +46,14 @@ 
 
 static uint8_t buffer[PADDED_SIZE];
 
-static struct socfpga_header {
+struct socfpga_header {
 	uint32_t validation;
 	uint8_t  version;
 	uint8_t  flags;
 	uint16_t length_u32;
 	uint16_t zero;
 	uint16_t checksum;
-} header;
+};
 
 /*
  * The header checksum is just a very simple checksum over
@@ -76,6 +76,8 @@  static uint16_t hdr_checksum(struct socfpga_header *header)
 static void build_header(uint8_t *buf, uint8_t version, uint8_t flags,
 			 uint16_t length_bytes)
 {
+	struct socfpga_header header;
+
 	header.validation = cpu_to_le32(VALIDATION_WORD);
 	header.version = version;
 	header.flags = flags;
@@ -92,6 +94,8 @@  static void build_header(uint8_t *buf, uint8_t version, uint8_t flags,
  */
 static int verify_header(const uint8_t *buf)
 {
+	struct socfpga_header header;
+
 	memcpy(&header, buf, sizeof(header));
 
 	if (le32_to_cpu(header.validation) != VALIDATION_WORD)