All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Yanok <yanok@emcraft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 07/10] mmc: use lldiv() for 64-bit division
Date: Wed,  6 May 2009 22:30:30 +0400	[thread overview]
Message-ID: <1241634633-13917-8-git-send-email-yanok@emcraft.com> (raw)
In-Reply-To: <1241634633-13917-1-git-send-email-yanok@emcraft.com>

Signed-off-by: Ilya Yanok <yanok@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);
 	sprintf(mmc->block_dev.vendor,"Man %02x%02x%02x Snr %02x%02x%02x%02x",
 			mmc->cid[0], mmc->cid[1], mmc->cid[2],
 			mmc->cid[9], mmc->cid[10], mmc->cid[11], mmc->cid[12]);
-- 
1.6.0.6

  parent reply	other threads:[~2009-05-06 18:30 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06 18:30 [U-Boot] [PATCH 00/10] Support for LogicPD i.MX27-LITEKIT development board Ilya Yanok
2009-05-06 18:30 ` [U-Boot] [PATCH 01/10] mx27: basic cpu support Ilya Yanok
2009-05-06 20:30   ` Magnus Lilja
2009-05-06 21:16   ` Wolfgang Denk
2009-05-13 22:54     ` Ilya Yanok
2009-05-14  8:10       ` Wolfgang Denk
2009-05-14  9:23         ` Ilya Yanok
2009-05-14  9:42           ` Wolfgang Denk
2009-05-14 10:26             ` Ilya Yanok
2009-05-14 12:33               ` Wolfgang Denk
2009-05-18 16:59             ` Magnus Lilja
2009-05-18 17:34               ` Scott Wood
2009-05-18 18:42               ` Wolfgang Denk
2009-05-14 13:40         ` Sascha Hauer
2009-05-14 13:56           ` Wolfgang Denk
2009-05-06 18:30 ` [U-Boot] [PATCH 02/10] serial_mx31: allow it to work with mx27 too Ilya Yanok
2009-05-06 21:16   ` Wolfgang Denk
2009-05-06 18:30 ` [U-Boot] [PATCH 03/10] fec_imx27: driver for FEC ethernet controller on i.MX27 Ilya Yanok
2009-05-06 19:51   ` Ben Warren
2009-05-06 21:20   ` Wolfgang Denk
2009-05-06 18:30 ` [U-Boot] [PATCH 04/10] mxc_nand: add nand driver for MX2/MX3 Ilya Yanok
2009-05-06 20:31   ` Magnus Lilja
2009-05-06 21:25   ` Wolfgang Denk
2009-05-08  8:39   ` Ivo Clarysse
2009-05-08  8:58     ` Magnus Lilja
2009-05-06 18:30 ` [U-Boot] [PATCH 05/10] mxc-mmc: sdhc host driver for MX2 and MX3 proccessor Ilya Yanok
2009-05-08  0:26   ` alfred steele
2009-05-13 21:50   ` alfred steele
2009-05-06 18:30 ` [U-Boot] [PATCH 06/10] arm: add support for CONFIG_GENERIC_MMC Ilya Yanok
2009-05-06 18:30 ` Ilya Yanok [this message]
2009-05-06 20:32   ` [U-Boot] [PATCH 07/10] mmc: use lldiv() for 64-bit division Magnus Lilja
2009-05-08 22:42   ` Andy Fleming
2009-05-06 18:30 ` [U-Boot] [PATCH 08/10] mmc: some endianess fixes for generic mmc subsystem Ilya Yanok
2009-05-08 22:43   ` Andy Fleming
2009-05-06 18:30 ` [U-Boot] [PATCH 09/10] mmc: fix mmcinfo command Ilya Yanok
2009-05-08 22:43   ` Andy Fleming
2009-05-06 18:30 ` [U-Boot] [PATCH 10/10] imx27lite: add support for imx27lite board from LogicPD Ilya Yanok
2009-05-06 20:34   ` Magnus Lilja
2009-05-08 18:19     ` Magnus Lilja
2009-05-06 21:29   ` Wolfgang Denk
2009-05-19 16:17   ` Paul Thomas
2009-05-20 18:49     ` Ilya Yanok
2009-05-20 19:49       ` Paul Thomas
2009-05-28 19:46       ` Paul Thomas
2009-05-28 21:45         ` Wolfgang Denk
2009-05-28 21:51           ` Paul Thomas
2009-06-11 22:38           ` Paul Thomas
2009-06-13 23:04             ` Paul Thomas
2009-05-06 21:26 ` [U-Boot] [PATCH 00/10] Support for LogicPD i.MX27-LITEKIT development board Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1241634633-13917-8-git-send-email-yanok@emcraft.com \
    --to=yanok@emcraft.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.