From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/5] tools: socfpga: Stop using global struct socfpga_image
Date: Sun, 15 Apr 2018 15:37:02 +0200 [thread overview]
Message-ID: <20180415133704.18950-3-marex@denx.de> (raw)
In-Reply-To: <20180415133704.18950-1-marex@denx.de>
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(-)
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)
--
2.16.2
next prev parent reply other threads:[~2018-04-15 13:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-15 13:37 [U-Boot] [PATCH 1/5] ARM: socfpga: Add boot trampoline for Arria10 Marek Vasut
2018-04-15 13:37 ` [U-Boot] [PATCH 2/5] image: socfpga: Add SFP image version 1 definition Marek Vasut
2018-04-17 8:41 ` See, Chin Liang
2018-04-15 13:37 ` Marek Vasut [this message]
2018-04-17 8:43 ` [U-Boot] [PATCH 3/5] tools: socfpga: Stop using global struct socfpga_image See, Chin Liang
2018-04-15 13:37 ` [U-Boot] [PATCH 4/5] tools: socfpga: Add SFP image V1 support Marek Vasut
2018-04-15 13:37 ` [U-Boot] [PATCH 5/5] spl: socfpga: Generate Arria10 SFP header V1 Marek Vasut
2018-04-17 8:54 ` See, Chin Liang
2018-04-17 8:40 ` [U-Boot] [PATCH 1/5] ARM: socfpga: Add boot trampoline for Arria10 See, Chin Liang
2018-04-17 8:46 ` Marek Vasut
2018-04-17 8:52 ` See, Chin Liang
2018-04-17 9:01 ` Marek Vasut
2018-04-17 9:11 ` See, Chin Liang
2018-04-17 9:28 ` Marek Vasut
2018-04-19 5:51 ` See, Chin Liang
2018-04-19 9:06 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180415133704.18950-3-marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox