Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1236284 > unrolled thread

[PATCH v2] mtd: mtdram: fix build error

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2015-09-30 15:30 +0200
Last post2015-09-30 18:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] mtd: mtdram: fix build error Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-30 15:30 +0200
    Re: [PATCH v2] mtd: mtdram: fix build error Brian Norris <computersforpeace@gmail.com> - 2015-09-30 18:00 +0200
      Re: [PATCH v2] mtd: mtdram: fix build error Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-30 18:30 +0200

#1236284 — [PATCH v2] mtd: mtdram: fix build error

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-09-30 15:30 +0200
Subject[PATCH v2] mtd: mtdram: fix build error
Message-ID<qepCi-6f9-13@gated-at.bofh.it>
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!

mips allmodconfig fails with:
ERROR: "__umoddi3" [drivers/mtd/devices/mtdram.ko] undefined!
ERROR: "__moddi3" [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>
---

v1 showed build warning with cris and xtensa. I have checked v2 with
arm, cris and xtensa.

 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..21b6a05 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;
+	uint64_t 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1236475

FromBrian Norris <computersforpeace@gmail.com>
Date2015-09-30 18:00 +0200
Message-ID<qerXt-14n-49@gated-at.bofh.it>
In reply to#1236284
On Wed, Sep 30, 2015 at 06:59:26PM +0530, Sudip Mukherjee wrote:
> 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!
> 
> mips allmodconfig fails with:
> ERROR: "__umoddi3" [drivers/mtd/devices/mtdram.ko] undefined!
> ERROR: "__moddi3" [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>
> ---
> 
> v1 showed build warning with cris and xtensa. I have checked v2 with
> arm, cris and xtensa.

I already reverted the bad patch, so this doesn't apply any more...

If you want to send a squashed patch that redoes this properly, I can
take it.

Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1236519

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-09-30 18:30 +0200
Message-ID<qesqv-1Sg-45@gated-at.bofh.it>
In reply to#1236475
On Wed, Sep 30, 2015 at 08:51:07AM -0700, Brian Norris wrote:
> On Wed, Sep 30, 2015 at 06:59:26PM +0530, Sudip Mukherjee wrote:
> > 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!
> > 
> > mips allmodconfig fails with:
> > ERROR: "__umoddi3" [drivers/mtd/devices/mtdram.ko] undefined!
> > ERROR: "__moddi3" [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>
> > ---
> > 
> > v1 showed build warning with cris and xtensa. I have checked v2 with
> > arm, cris and xtensa.
> 
> I already reverted the bad patch, so this doesn't apply any more...
> 
> If you want to send a squashed patch that redoes this properly, I can
> take it.

Ok. Sending the new patch.

regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web