summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-05-24 17:38:19 -0600
committerBin Meng <bmeng.cn@gmail.com>2020-05-27 14:40:09 +0800
commite82ab51bafecef063a081851d592fe82b680d50f (patch)
tree88acdbe3e28706c5f5ae93f0759bfefa1201b0ce /fs
parent9dc2355e515d2026b40da3beab5b9ebaef854c4c (diff)
cbfs: Use void * for the position pointers
It doesn't make sense to use u8 * as the pointer type for accessing the CBFS since we do not access it as bytes, but via structures. Change it to void *, which allows us to avoid a cast. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cbfs/cbfs.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index a42c3a51d5..40198ae7e7 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -83,7 +83,7 @@ static void swap_file_header(struct cbfs_fileheader *dest,
* @return 0 if a file is found, -ENOENT if one isn't, -EBADF if a bad header
* is found.
*/
-static int file_cbfs_next_file(struct cbfs_priv *priv, u8 *start, int size,
+static int file_cbfs_next_file(struct cbfs_priv *priv, void *start, int size,
int align, struct cbfs_cachenode *new_node,
int *used)
{
@@ -92,8 +92,7 @@ static int file_cbfs_next_file(struct cbfs_priv *priv, u8 *start, int size,
*used = 0;
while (size >= align) {
- const struct cbfs_fileheader *file_header =
- (const struct cbfs_fileheader *)start;
+ const struct cbfs_fileheader *file_header = start;
u32 name_len;
u32 step;
@@ -133,7 +132,7 @@ static int file_cbfs_next_file(struct cbfs_priv *priv, u8 *start, int size,
}
/* Look through a CBFS instance and copy file metadata into regular memory. */
-static int file_cbfs_fill_cache(struct cbfs_priv *priv, u8 *start, u32 size,
+static int file_cbfs_fill_cache(struct cbfs_priv *priv, void *start, u32 size,
u32 align)
{
struct cbfs_cachenode *cache_node;
@@ -232,12 +231,12 @@ static int cbfs_load_header_ptr(struct cbfs_priv *priv, ulong base)
static void cbfs_init(struct cbfs_priv *priv, ulong end_of_rom)
{
- u8 *start_of_rom;
+ void *start_of_rom;
if (file_cbfs_load_header(priv, end_of_rom))
return;
- start_of_rom = (u8 *)(end_of_rom + 1 - priv->header.rom_size);
+ start_of_rom = (void *)(end_of_rom + 1 - priv->header.rom_size);
file_cbfs_fill_cache(priv, start_of_rom, priv->header.rom_size,
priv->header.align);
@@ -263,7 +262,7 @@ int cbfs_init_mem(ulong base, ulong size, struct cbfs_priv **privp)
if (ret)
return ret;
- file_cbfs_fill_cache(priv, (u8 *)base, priv->header.rom_size,
+ file_cbfs_fill_cache(priv, (void *)base, priv->header.rom_size,
priv->header.align);
if (priv->result != CBFS_SUCCESS)
return -EINVAL;
@@ -351,7 +350,7 @@ const struct cbfs_cachenode *file_cbfs_find_uncached(ulong end_of_rom,
const char *name)
{
struct cbfs_priv *priv = &cbfs_s;
- u8 *start;
+ void *start;
u32 size;
u32 align;
static struct cbfs_cachenode node;
@@ -359,7 +358,7 @@ const struct cbfs_cachenode *file_cbfs_find_uncached(ulong end_of_rom,
if (file_cbfs_load_header(priv, end_of_rom))
return NULL;
- start = (u8 *)(end_of_rom + 1 - priv->header.rom_size);
+ start = (void *)(end_of_rom + 1 - priv->header.rom_size);
size = priv->header.rom_size;
align = priv->header.align;