All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH 05/13] cbfs: Adjust file_cbfs_load_header() to use cbfs_priv
Date: Wed, 13 May 2020 08:23:51 -0600	[thread overview]
Message-ID: <20200513142359.147589-6-sjg@chromium.org> (raw)
In-Reply-To: <20200513142359.147589-1-sjg@chromium.org>

This function is strange at the moment in that it takes a header pointer
but then accesses the cbfs_s global. Currently clients have their own priv
pointer, so update the function to take that as a parameter instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 fs/cbfs/cbfs.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index 1037d19225..765e078423 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -175,8 +175,9 @@ static int file_cbfs_fill_cache(struct cbfs_priv *priv, u8 *start, u32 size,
 }
 
 /* Get the CBFS header out of the ROM and do endian conversion. */
-static int file_cbfs_load_header(ulong end_of_rom, struct cbfs_header *header)
+static int file_cbfs_load_header(struct cbfs_priv *priv, ulong end_of_rom)
 {
+	struct cbfs_header *header = &priv->header;
 	struct cbfs_header *header_in_rom;
 	int32_t offset = *(u32 *)(end_of_rom - 3);
 
@@ -185,7 +186,7 @@ static int file_cbfs_load_header(ulong end_of_rom, struct cbfs_header *header)
 
 	if (header->magic != good_magic || header->offset >
 			header->rom_size - header->boot_block_size) {
-		cbfs_s.result = CBFS_BAD_HEADER;
+		priv->result = CBFS_BAD_HEADER;
 		return 1;
 	}
 	return 0;
@@ -214,7 +215,7 @@ static void cbfs_init(struct cbfs_priv *priv, ulong end_of_rom)
 
 	priv->initialised = false;
 
-	if (file_cbfs_load_header(end_of_rom, &priv->header))
+	if (file_cbfs_load_header(priv, end_of_rom))
 		return;
 
 	start_of_rom = (u8 *)(end_of_rom + 1 - priv->header.rom_size);
@@ -337,7 +338,7 @@ const struct cbfs_cachenode *file_cbfs_find_uncached(ulong end_of_rom,
 	u32 align;
 	static struct cbfs_cachenode node;
 
-	if (file_cbfs_load_header(end_of_rom, &priv->header))
+	if (file_cbfs_load_header(priv, end_of_rom))
 		return NULL;
 
 	start = (u8 *)(end_of_rom + 1 - priv->header.rom_size);
-- 
2.26.2.645.ge9eca65c58-goog

  parent reply	other threads:[~2020-05-13 14:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 14:23 [PATCH 00/13] x86: cbfs: Various clean-ups to CBFS implementation Simon Glass
2020-05-13 14:23 ` [PATCH 01/13] cbfs: Rename the result variable Simon Glass
2020-05-19 13:53   ` Bin Meng
2020-05-22 16:33     ` Simon Glass
2020-05-13 14:23 ` [PATCH 02/13] cbfs: Use ulong consistently Simon Glass
2020-05-19 13:53   ` Bin Meng
2020-05-13 14:23 ` [PATCH 03/13] cbfs: Use bool type for whether initialised Simon Glass
2020-05-19 13:53   ` Bin Meng
2020-05-22 16:33     ` Simon Glass
2020-05-13 14:23 ` [PATCH 04/13] cbfs: Adjust return value of file_cbfs_next_file() Simon Glass
2020-05-19 14:04   ` Bin Meng
2020-05-13 14:23 ` Simon Glass [this message]
2020-05-19 14:04   ` [PATCH 05/13] cbfs: Adjust file_cbfs_load_header() to use cbfs_priv Bin Meng
2020-05-13 14:23 ` [PATCH 06/13] cbfs: Adjust cbfs_load_header_ptr() " Simon Glass
2020-05-19 14:04   ` Bin Meng
2020-05-13 14:23 ` [PATCH 07/13] cbfs: Unify the two header loaders Simon Glass
2020-05-21  2:27   ` Bin Meng
2020-05-13 14:23 ` [PATCH 08/13] cbfs: Use void * for the position pointers Simon Glass
2020-05-21  2:28   ` Bin Meng
2020-05-13 14:23 ` [PATCH 09/13] cbfs: Record the start address in cbfs_priv Simon Glass
2020-05-21  2:31   ` Bin Meng
2020-05-13 14:23 ` [PATCH 10/13] cbfs: Return the error code from file_cbfs_init() Simon Glass
2020-05-21  2:32   ` Bin Meng
2020-05-13 14:23 ` [PATCH 11/13] cbfs: Change file_cbfs_find_uncached() to return an error Simon Glass
2020-05-21  2:55   ` Bin Meng
2020-05-13 14:23 ` [PATCH 12/13] cbfs: Allow reading a file from a CBFS given its base addr Simon Glass
2020-05-21  2:59   ` Bin Meng
2020-05-22  2:46     ` Simon Glass
2020-05-13 14:23 ` [PATCH 13/13] cbfs: Don't require the CBFS size with cbfs_init_mem() Simon Glass
2020-05-21  3:00   ` Bin Meng

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=20200513142359.147589-6-sjg@chromium.org \
    --to=sjg@chromium.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.