Commit 43fa593e authored by Ben Dooks (Codethink)'s avatar Ben Dooks (Codethink) Committed by Russell King

ARM: 8915/1: zImage: atags_to_fdt: fix __be32 and __be64 types

There are some sparse warnings about type conversion in
the atags_to_fdt.c code, due to __be32 and __be64, so
fix the following:

- Change _be32 and __be64 where appropriate
- Change setprop() to take a 'void *'
- Change incorrect fdt32_to_cpu() on FDT_MAGIC

Fixes the following sparse warnings:

arch/arm/boot/compressed/atags_to_fdt.c:66:29: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:66:29: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:66:29: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:66:29: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:66:29: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:66:29: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:141:34: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:141:34: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:141:34: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:141:34: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:141:34: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:141:34: warning: cast to restricted __be32
arch/arm/boot/compressed/atags_to_fdt.c:182:60: warning: incorrect type in assignment (different base types)
arch/arm/boot/compressed/atags_to_fdt.c:182:60:    expected unsigned long long [usertype]
arch/arm/boot/compressed/atags_to_fdt.c:182:60:    got restricted __be64 [usertype]
arch/arm/boot/compressed/atags_to_fdt.c:184:60: warning: incorrect type in assignment (different base types)
arch/arm/boot/compressed/atags_to_fdt.c:184:60:    expected unsigned long long [usertype]
arch/arm/boot/compressed/atags_to_fdt.c:184:60:    got restricted __be64 [usertype]
arch/arm/boot/compressed/atags_to_fdt.c:187:62: warning: incorrect type in assignment (different base types)
arch/arm/boot/compressed/atags_to_fdt.c:187:62:    expected unsigned int
arch/arm/boot/compressed/atags_to_fdt.c:187:62:    got restricted __be32 [usertype]
arch/arm/boot/compressed/atags_to_fdt.c:189:62: warning: incorrect type in assignment (different base types)
arch/arm/boot/compressed/atags_to_fdt.c:189:62:    expected unsigned int
arch/arm/boot/compressed/atags_to_fdt.c:189:62:    got restricted __be32 [usertype]
Signed-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent 05b1fd8b
......@@ -19,7 +19,7 @@ static int node_offset(void *fdt, const char *node_path)
}
static int setprop(void *fdt, const char *node_path, const char *property,
uint32_t *val_array, int size)
void *val_array, int size)
{
int offset = node_offset(fdt, node_path);
if (offset < 0)
......@@ -60,7 +60,7 @@ static uint32_t get_cell_size(const void *fdt)
{
int len;
uint32_t cell_size = 1;
const uint32_t *size_len = getprop(fdt, "/", "#size-cells", &len);
const __be32 *size_len = getprop(fdt, "/", "#size-cells", &len);
if (size_len)
cell_size = fdt32_to_cpu(*size_len);
......@@ -129,7 +129,7 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
struct tag *atag = atag_list;
/* In the case of 64 bits memory size, need to reserve 2 cells for
* address and size for each bank */
uint32_t mem_reg_property[2 * 2 * NR_BANKS];
__be32 mem_reg_property[2 * 2 * NR_BANKS];
int memcount = 0;
int ret, memsize;
......@@ -138,7 +138,7 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
return 1;
/* if we get a DTB here we're done already */
if (*(u32 *)atag_list == fdt32_to_cpu(FDT_MAGIC))
if (*(__be32 *)atag_list == cpu_to_fdt32(FDT_MAGIC))
return 0;
/* validate the ATAG */
......@@ -177,8 +177,8 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
/* if memsize is 2, that means that
* each data needs 2 cells of 32 bits,
* so the data are 64 bits */
uint64_t *mem_reg_prop64 =
(uint64_t *)mem_reg_property;
__be64 *mem_reg_prop64 =
(__be64 *)mem_reg_property;
mem_reg_prop64[memcount++] =
cpu_to_fdt64(atag->u.mem.start);
mem_reg_prop64[memcount++] =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment