yaffs2: Use lldiv for 64bit division
authorTom Rini <trini@ti.com>
Thu, 5 Dec 2013 19:48:39 +0000 (14:48 -0500)
committerTom Rini <trini@ti.com>
Fri, 13 Dec 2013 14:16:20 +0000 (09:16 -0500)
Signed-off-by: Tom Rini <trini@ti.com>
fs/yaffs2/yaffs_uboot_glue.c
fs/yaffs2/yaffsfs.c

index e113e4039e1f78a66d7258142df8854f6519eb06..50000a135b54f229e4aa914939ab6c554bdab0c4 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <common.h>
+#include <div64.h>
 
 #include <config.h>
 #include "nand.h"
@@ -184,7 +185,7 @@ void cmd_yaffs_devconfig(char *_mp, int flash_dev,
        }
 
        if (end_block == 0)
-               end_block = mtd->size / mtd->erasesize - 1;
+               end_block = lldiv(mtd->size, mtd->erasesize - 1);
 
        if (end_block < start_block) {
                printf("Bad start/end\n");
index ac4a010bdf7c413b1a37f831fbedf25e7dd32b16..334598eedff9bf4e46d6d3a5b25371ea11461486 100644 (file)
@@ -11,6 +11,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <div64.h>
 #include "yaffsfs.h"
 #include "yaffs_guts.h"
 #include "yaffscfg.h"
@@ -1603,8 +1604,8 @@ static int yaffsfs_DoStat(struct yaffs_obj *obj, struct yaffs_stat *buf)
                buf->st_rdev = obj->yst_rdev;
                buf->st_size = yaffs_get_obj_length(obj);
                buf->st_blksize = obj->my_dev->data_bytes_per_chunk;
-               buf->st_blocks = (buf->st_size + buf->st_blksize - 1) /
-                   buf->st_blksize;
+               buf->st_blocks = lldiv(buf->st_size + buf->st_blksize - 1,
+                   buf->st_blksize);
 #if CONFIG_YAFFS_WINCE
                buf->yst_wince_atime[0] = obj->win_atime[0];
                buf->yst_wince_atime[1] = obj->win_atime[1];