From patchwork Fri May 22 02:58:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 246224 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Thu, 21 May 2020 20:58:59 -0600 Subject: [PATCH v2 03/13] cbfs: Use bool type for whether initialised In-Reply-To: <20200522025909.249740-1-sjg@chromium.org> References: <20200522025909.249740-1-sjg@chromium.org> Message-ID: <20200522025909.249740-4-sjg@chromium.org> At present this uses an int type. U-Boot now supports bool so use this instead. Also use English spelling for initialised which we are here. Signed-off-by: Simon Glass --- Changes in v2: None fs/cbfs/cbfs.c | 28 ++++++++++++++-------------- include/cbfs.h | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c index 846102dce38..322778d1c82 100644 --- a/fs/cbfs/cbfs.c +++ b/fs/cbfs/cbfs.c @@ -12,7 +12,7 @@ static const u32 good_magic = 0x4f524243; static const u8 good_file_magic[] = "LARCHIVE"; struct cbfs_priv { - int initialized; + bool initialised; struct cbfs_header header; struct cbfs_cachenode *file_cache; enum cbfs_result result; @@ -25,8 +25,8 @@ const char *file_cbfs_error(void) switch (cbfs_s.result) { case CBFS_SUCCESS: return "Success"; - case CBFS_NOT_INITIALIZED: - return "CBFS not initialized"; + case CBFS_NOT_INITIALISED: + return "CBFS not initialised"; case CBFS_BAD_HEADER: return "Bad CBFS header"; case CBFS_BAD_FILE: @@ -207,7 +207,7 @@ static void cbfs_init(struct cbfs_priv *priv, ulong end_of_rom) { u8 *start_of_rom; - priv->initialized = 0; + priv->initialised = false; if (file_cbfs_load_header(end_of_rom, &priv->header)) return; @@ -217,7 +217,7 @@ static void cbfs_init(struct cbfs_priv *priv, ulong end_of_rom) file_cbfs_fill_cache(priv, start_of_rom, priv->header.rom_size, priv->header.align); if (priv->result == CBFS_SUCCESS) - priv->initialized = 1; + priv->initialised = true; } void file_cbfs_init(ulong end_of_rom) @@ -244,7 +244,7 @@ int cbfs_init_mem(ulong base, ulong size, struct cbfs_priv **privp) if (priv->result != CBFS_SUCCESS) return -EINVAL; - priv->initialized = 1; + priv->initialised = true; priv = malloc(sizeof(priv_s)); if (!priv) return -ENOMEM; @@ -258,11 +258,11 @@ const struct cbfs_header *file_cbfs_get_header(void) { struct cbfs_priv *priv = &cbfs_s; - if (priv->initialized) { + if (priv->initialised) { priv->result = CBFS_SUCCESS; return &priv->header; } else { - priv->result = CBFS_NOT_INITIALIZED; + priv->result = CBFS_NOT_INITIALISED; return NULL; } } @@ -271,8 +271,8 @@ const struct cbfs_cachenode *file_cbfs_get_first(void) { struct cbfs_priv *priv = &cbfs_s; - if (!priv->initialized) { - priv->result = CBFS_NOT_INITIALIZED; + if (!priv->initialised) { + priv->result = CBFS_NOT_INITIALISED; return NULL; } else { priv->result = CBFS_SUCCESS; @@ -284,8 +284,8 @@ void file_cbfs_get_next(const struct cbfs_cachenode **file) { struct cbfs_priv *priv = &cbfs_s; - if (!priv->initialized) { - priv->result = CBFS_NOT_INITIALIZED; + if (!priv->initialised) { + priv->result = CBFS_NOT_INITIALISED; *file = NULL; return; } @@ -300,8 +300,8 @@ const struct cbfs_cachenode *cbfs_find_file(struct cbfs_priv *priv, { struct cbfs_cachenode *cache_node = priv->file_cache; - if (!priv->initialized) { - priv->result = CBFS_NOT_INITIALIZED; + if (!priv->initialised) { + priv->result = CBFS_NOT_INITIALISED; return NULL; } diff --git a/include/cbfs.h b/include/cbfs.h index 07bbcfd2cff..8b297c23d5a 100644 --- a/include/cbfs.h +++ b/include/cbfs.h @@ -11,7 +11,7 @@ enum cbfs_result { CBFS_SUCCESS = 0, - CBFS_NOT_INITIALIZED, + CBFS_NOT_INITIALISED, CBFS_BAD_HEADER, CBFS_BAD_FILE, CBFS_FILE_NOT_FOUND