diff options
author | Wolfgang Denk <wd@denx.de> | 2008-04-28 12:08:18 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-04-28 12:08:18 +0200 |
commit | 4ca79f477ebd25a6872e6196d80e2f5eff441376 (patch) | |
tree | fa08b5ac950b83248d49e681f66a5ed530eb71dc | |
parent | ff8a7aa24a22fe332a57627a23c14bfd7e51599b (diff) |
NAND: fix some strict-aliasing compiler warnings
Signed-off-by: Wolfgang Denk <wd@denx.de>
-rw-r--r-- | common/cmd_nand.c | 19 | ||||
-rw-r--r-- | common/env_nand.c | 2 | ||||
-rw-r--r-- | include/nand.h | 8 |
3 files changed, 15 insertions, 14 deletions
diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 7b1f8304657..f8fce0ea438 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -93,7 +93,7 @@ static inline int str2long(char *p, ulong *num) } static int -arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off, ulong *size) +arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off, size_t *size) { int idx = nand_curr_device; #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE) @@ -136,7 +136,7 @@ arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off, ulong *size) } if (argc >= 2) { - if (!(str2long(argv[1], size))) { + if (!(str2long(argv[1], (ulong *)size))) { printf("'%s' is not a number\n", argv[1]); return -1; } @@ -158,7 +158,8 @@ out: int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { int i, dev, ret; - ulong addr, off, size; + ulong addr, off; + size_t size; char *cmd, *s; nand_info_t *nand; #ifdef CFG_NAND_QUIET @@ -350,10 +351,10 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } else if (s != NULL && !strcmp(s, ".oob")) { /* read out-of-band data */ if (read) - ret = nand->read_oob(nand, off, size, (size_t *) &size, + ret = nand->read_oob(nand, off, size, &size, (u_char *) addr); else - ret = nand->write_oob(nand, off, size, (size_t *) &size, + ret = nand->write_oob(nand, off, size, &size, (u_char *) addr); } else { if (read) @@ -481,7 +482,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, { int r; char *ep, *s; - ulong cnt; + size_t cnt; image_header_t *hdr; int jffs2 = 0; #if defined(CONFIG_FIT) @@ -851,11 +852,11 @@ int do_nand (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) /* read out-of-band data */ if (cmd & NANDRW_READ) { ret = nand_read_oob (nand_dev_desc + curr_device, - off, size, (size_t *) & total, + off, size, &total, (u_char *) addr); } else { ret = nand_write_oob (nand_dev_desc + curr_device, - off, size, (size_t *) & total, + off, size, &total, (u_char *) addr); } return ret; @@ -891,7 +892,7 @@ int do_nand (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) ret = nand_legacy_rw (nand_dev_desc + curr_device, cmd, off, size, - (size_t *) & total, + &total, (u_char *) addr); printf (" %d bytes %s: %s\n", total, diff --git a/common/env_nand.c b/common/env_nand.c index ce0a2514db4..b6a5b4aaab3 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -154,7 +154,7 @@ int env_init(void) #ifdef CFG_ENV_OFFSET_REDUND int saveenv(void) { - ulong total; + size_t total; int ret = 0; env_ptr->flags++; diff --git a/include/nand.h b/include/nand.h index 3c0752ea12a..247d3465dbb 100644 --- a/include/nand.h +++ b/include/nand.h @@ -34,22 +34,22 @@ extern int nand_curr_device; extern nand_info_t nand_info[]; extern void nand_init(void); -static inline int nand_read(nand_info_t *info, ulong ofs, ulong *len, u_char *buf) +static inline int nand_read(nand_info_t *info, off_t ofs, size_t *len, u_char *buf) { return info->read(info, ofs, *len, (size_t *)len, buf); } -static inline int nand_write(nand_info_t *info, ulong ofs, ulong *len, u_char *buf) +static inline int nand_write(nand_info_t *info, off_t ofs, size_t *len, u_char *buf) { return info->write(info, ofs, *len, (size_t *)len, buf); } -static inline int nand_block_isbad(nand_info_t *info, ulong ofs) +static inline int nand_block_isbad(nand_info_t *info, off_t ofs) { return info->block_isbad(info, ofs); } -static inline int nand_erase(nand_info_t *info, ulong off, ulong size) +static inline int nand_erase(nand_info_t *info, off_t off, size_t size) { struct erase_info instr; |