From: Chanho Park Date: Fri, 3 Jul 2015 04:48:51 +0000 (+0900) Subject: common: usd do_div to divide 64bit value X-Git-Tag: submit/tizen/20160318.071304~150 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c69c8c3076de10b72025907fa05e426a54a99af0;p=profile%2Fcommon%2Fplatform%2Fkernel%2Fu-boot-artik.git common: usd do_div to divide 64bit value When we use the recent gcc compiler with armhf, it causes build errors related with VFP registers. Thus, we should use do_div in case of 64bits divisions. Signed-off-by: Chanho Park --- diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 888e3c979..dad6de842 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -24,6 +24,7 @@ #include #include #include +#include static int curr_device = -1; #ifndef CONFIG_GENERIC_MMC @@ -324,10 +325,12 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } else if (strcmp(argv[2], "user") == 0) { part = 1; /* Read User partition size. */ - count = mmc->capacity / mmc->read_bl_len; + count = do_div(mmc->capacity, + mmc->read_bl_len); } else { part = 1; - count = mmc->capacity / mmc->read_bl_len; + count = do_div(mmc->capacity, + mmc->read_bl_len); printf("Default erase user partition\n"); } diff --git a/common/cmd_mmc_fdisk.c b/common/cmd_mmc_fdisk.c index a37a817b5..58701e4fa 100644 --- a/common/cmd_mmc_fdisk.c +++ b/common/cmd_mmc_fdisk.c @@ -12,6 +12,7 @@ #include #include #include +#include #define BLOCK_SIZE 512 #define BLOCK_END 0xFFFFFFFF @@ -64,9 +65,10 @@ typedef struct int calc_unit(unsigned long long length, SDInfo sdInfo) { if (sdInfo.addr_mode == CHS_MODE) - return ( (length / BLOCK_SIZE / sdInfo.unit + 1 ) * sdInfo.unit); + return ( (do_div(length, (BLOCK_SIZE / sdInfo.unit)) + 1 ) + * sdInfo.unit); else - return ( (length / BLOCK_SIZE) ); + return ( (do_div(length, BLOCK_SIZE)) ); } ///////////////////////////////////////////////////////////////// @@ -313,7 +315,7 @@ int get_mmc_block_count(char *device_name) return -1; } - block_count = mmc->capacity / mmc->read_bl_len; + block_count = do_div(mmc->capacity, mmc->read_bl_len); // printf("block_count = %d\n", block_count); return block_count; diff --git a/common/decompress_ext4.c b/common/decompress_ext4.c index 12c75aa49..9c1fa183b 100644 --- a/common/decompress_ext4.c +++ b/common/decompress_ext4.c @@ -16,6 +16,7 @@ #include #include #include +#include #define SECTOR_BITS 9 /* 512B */ @@ -57,8 +58,9 @@ int check_compress_ext4(char *img_base, unsigned long long parti_size) { if ((parti_size/file_header->block_size) < file_header->total_blocks) { printf("Invalid Volume Size! Image is bigger than partition size!\n"); - printf("partion size %lld , image size %d \n", - (parti_size/file_header->block_size), file_header->total_blocks); + printf("partion size %ld , image size %d \n", + (do_div(parti_size, file_header->block_size)), + file_header->total_blocks); while(1); }