linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: mtdram: fix build error
@ 2015-09-30  8:35 Sudip Mukherjee
  2015-09-30  8:50 ` kbuild test robot
  2015-09-30  9:28 ` kbuild test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2015-09-30  8:35 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, Dongsheng Yang
  Cc: linux-kernel, linux-mtd, Stephen Rothwell, Sudip Mukherjee

i386 allmodconfig fails with:
ERROR: "__umoddi3" [drivers/mtd/devices/mtdram.ko] undefined!
ERROR: "__moddi3" [drivers/mtd/devices/mtdram.ko] undefined!

arm allmodconfig fails with:
ERROR: "__aeabi_uldivmod" [drivers/mtd/devices/mtdram.ko] undefined!
ERROR: "__aeabi_ldivmod" [drivers/mtd/devices/mtdram.ko] undefined!

The modulus operation is not being supported by these compilers. Use
do_div() instead which returns the remainder.

Fixes: 7827e3acad2d ("mtd: mtdram: check offs and len in mtdram->erase")
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/mtd/devices/mtdram.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c
index 73fa297..d085167 100644
--- a/drivers/mtd/devices/mtdram.c
+++ b/drivers/mtd/devices/mtdram.c
@@ -35,15 +35,21 @@ static struct mtd_info *mtd_info;
 static int check_offs_len(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 {
 	int ret = 0;
+	unsigned long temp_len, rem;
 
 	/* Start address must align on block boundary */
-	if (ofs % mtd->erasesize) {
+	temp_len = ofs;
+	rem = do_div(temp_len, mtd->erasesize);
+	if (rem) {
 		pr_debug("%s: unaligned address\n", __func__);
 		ret = -EINVAL;
 	}
 
 	/* Length must align on block boundary */
-	if (len % mtd->erasesize) {
+	temp_len = len;
+	rem = do_div(temp_len, mtd->erasesize);
+
+	if (rem) {
 		pr_debug("%s: length not block aligned\n", __func__);
 		ret = -EINVAL;
 	}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-30  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-30  8:35 [PATCH] mtd: mtdram: fix build error Sudip Mukherjee
2015-09-30  8:50 ` kbuild test robot
2015-09-30  9:28 ` kbuild test robot
2015-09-30  9:46   ` Sudip Mukherjee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).