[PATCH 03/13] cbfs: Use bool type for whether initialised

Simon Glass sjg at chromium.org
Wed May 13 16:23:49 CEST 2020


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 <sjg at chromium.org>
---

 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 846102dce3..322778d1c8 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 10e951dccf..80ce539070 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
-- 
2.26.2.645.ge9eca65c58-goog



More information about the U-Boot mailing list