]> git.sur5r.net Git - u-boot/commitdiff
NAND: fix some strict-aliasing compiler warnings
authorWolfgang Denk <wd@denx.de>
Mon, 28 Apr 2008 10:08:18 +0000 (12:08 +0200)
committerWolfgang Denk <wd@denx.de>
Mon, 28 Apr 2008 10:08:18 +0000 (12:08 +0200)
Signed-off-by: Wolfgang Denk <wd@denx.de>
common/cmd_nand.c
common/env_nand.c
include/nand.h

index 7b1f83046572d1a30d4a09dd232964117a2242f7..f8fce0ea438985b6b5fc85f7631a4ea014a16300 100644 (file)
@@ -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,
index ce0a2514db458f8bd7cac293ccd7ecdf21ea7d42..b6a5b4aaab3253ae3f31619d7681afc1472657c3 100644 (file)
@@ -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++;
index 3c0752ea12add98ca4c67e736b09434ea684fc78..247d3465dbb0b140e4cb14fe242022ae0995ca0b 100644 (file)
@@ -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;