[U-Boot] [PATCH 07/10] mmc: use lldiv() for 64-bit division
Magnus Lilja
lilja.magnus at gmail.com
Wed May 6 22:32:17 CEST 2009
Hi
2009/5/6 Ilya Yanok <yanok at emcraft.com>:
> Signed-off-by: Ilya Yanok <yanok at emcraft.com>
> ---
> drivers/mmc/mmc.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 7791c38..77a9aea 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -31,6 +31,7 @@
> #include <malloc.h>
> #include <linux/list.h>
> #include <mmc.h>
> +#include <div64.h>
>
> static struct list_head mmc_devices;
> static int cur_dev_num = -1;
> @@ -155,8 +156,8 @@ int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size)
> char *buffer;
> int i;
> int blklen = mmc->read_bl_len;
> - int startblock = src / blklen;
> - int endblock = (src + size - 1) / blklen;
> + int startblock = lldiv(src, blklen);
> + int endblock = lldiv((src + size - 1), blklen);
> int err = 0;
>
> /* Make a buffer big enough to hold all the blocks we might read */
> @@ -789,7 +790,7 @@ int mmc_startup(struct mmc *mmc)
> mmc->block_dev.lun = 0;
> mmc->block_dev.type = 0;
> mmc->block_dev.blksz = mmc->read_bl_len;
> - mmc->block_dev.lba = mmc->capacity/mmc->read_bl_len;
> + mmc->block_dev.lba = lldiv(mmc->capacity,mmc->read_bl_len);
Add space after comma.
Regards, Magnus
More information about the U-Boot
mailing list